Merge "LVM migration: Check if name is equal to dest_vg" into stable/havana

This commit is contained in:
Jenkins 2013-12-20 18:24:07 +00:00 committed by Gerrit Code Review
commit ace214a87f
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)