GitHub user rhtyd reopened a pull request: https://github.com/apache/cloudstack/pull/1656
CLOUDSTACK-9466: Fix fk constraint failure in upgrade path In the 4.1.0-4.2.0 db upgrade path, it creates new tables to store secondary (nfs) storage in image_store table and volumes in volume_store_ref table. In the upgrade path, it first tries to migrate NFS storage pool where it excludes storage pools which have been removed, but it migrates all the volumes without checking if their storage pools have been removed. This causes fk constraint failure as the volume/row being inserted refers to a storage pool which does not exist in the image_store table. The fix migrates all the nfs storage pools to image_store including removed storage pools and in doing so migrates with the 'removed' field. This fixes db upgrade for old pre-4.0 and 4.0/4.1 CloudStack clouds. /cc @jburwell @PaulAngus @karuturi @abhinandanprateek @murali-reddy You can merge this pull request into a Git repository by running: $ git pull https://github.com/shapeblue/cloudstack 4.9-fk410to420fix Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cloudstack/pull/1656.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1656 ---- commit 7530f4b6dd98c18bceda3e1bf7790c0689ff5441 Author: Rohit Yadav <rohit.ya...@shapeblue.com> Date: 2016-08-23T07:53:18Z CLOUDSTACK-9466: Fix fk constraint failure in upgrade path In the 4.1.0-4.2.0 db upgrade path, it creates new tables to store secondary (nfs) storage in image_store table and volumes in volume_store_ref table. In the upgrade path, it first tries to migrate NFS storage pool where it excludes storage pools which have been removed, but it migrates all the volumes without checking if their storage pools have been removed. This causes fk constraint failure as the volume/row being inserted refers to a storage pool which does not exist in the image_store table. The fix migrates all the nfs storage pools to image_store including removed storage pools and in doing so migrates with the 'removed' field. This fixes db upgrade for old pre-4.0 and 4.0/4.1 CloudStack clouds. Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com> ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---