From: Flavio Percoco Date: Thu, 5 Dec 2013 16:05:33 +0000 (+0100) Subject: LVM migration: Check if name is equal to dest_vg X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=17912f4c4fba270a15cab47bb68d9e30c34a69b0;p=openstack-build%2Fcinder-build.git LVM migration: Check if name is equal to dest_vg The existence check of the destination volume group is wrong. It currently checks if there's a VG with a name equal to the source's vg name instead of checking if it's equal to the dest_vg. Closes-bug: #1258203 Change-Id: Ia5d4acb24b94c6aa832107c7eb4b6996985af97f --- diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 43aa3c52e..21bdf3527 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -2199,8 +2199,9 @@ class LVMISCSIVolumeDriverTestCase(DriverTestCase): pass def get_all_volume_groups(): - return [{'name': 'cinder-volumes-2'}, - {'name': 'cinder-volumes'}] + # NOTE(flaper87) Return just the destination + # host to test the check of dest VG existence. + return [{'name': 'cinder-volumes-2'}] self.stubs.Set(self.volume.driver, '_execute', fake_execute) diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index 40aa62e86..5d86f7019 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -701,7 +701,7 @@ class LVMISCSIDriver(LVMVolumeDriver, driver.ISCSIDriver): if dest_vg != self.vg.vg_name: vg_list = volutils.get_all_volume_groups() vg_dict = \ - (vg for vg in vg_list if vg['name'] == self.vg.vg_name).next() + (vg for vg in vg_list if vg['name'] == dest_vg).next() if vg_dict is None: message = ("Destination Volume Group %s does not exist" % dest_vg)