]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
LVM migration: Check if name is equal to dest_vg
authorFlavio Percoco <flaper87@gmail.com>
Thu, 5 Dec 2013 16:05:33 +0000 (17:05 +0100)
committerFlavio Percoco <flaper87@gmail.com>
Thu, 5 Dec 2013 22:28:37 +0000 (23:28 +0100)
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

cinder/tests/test_volume.py
cinder/volume/drivers/lvm.py

index 43aa3c52eceea0bf263ce0491f0dd3bc8c4c9d46..21bdf3527c90707d492e887bee5073186d1b39f2 100644 (file)
@@ -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)
 
index 40aa62e8698753b792a6894342b6755df331a9c1..5d86f7019532c78e9f1baca7cd1284420cad73c0 100644 (file)
@@ -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)