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
(cherry picked from commit 17912f4c4f)

Change-Id: Ia5d4acb24b94c6aa832107c7eb4b6996985af97f
This commit is contained in:
Flavio Percoco 2013-12-05 17:05:33 +01:00
parent a61b9678f1
commit 468cfc2672
2 changed files with 4 additions and 3 deletions

View File

@ -2141,8 +2141,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)

View File

@ -706,7 +706,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)