Merge "LVM migration: Check if name is equal to dest_vg"

This commit is contained in:
Jenkins 2013-12-09 22:15:45 +00:00 committed by Gerrit Code Review
commit 0f24cf91e1
2 changed files with 4 additions and 3 deletions

View File

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

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