Merge "Fix AttributeError related to volume data check"

This commit is contained in:
Jenkins 2017-05-10 17:54:59 +00:00 committed by Gerrit Code Review
commit 6f6d30e35f
2 changed files with 3 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2015 IBM Corp.
# Copyright 2015, 2017 IBM Corp.
#
# All Rights Reserved.
#
@ -199,7 +199,6 @@ class TestLPM(test.TestCase):
def test_src_cleanup(self):
vol_drv = mock.Mock()
self.lpmdst.pre_live_vol_data = {}
self.lpmdst.cleanup_volume(vol_drv)
# Ensure the volume driver is not called
self.assertEqual(0, vol_drv.cleanup_volume_at_destination.call_count)

View File

@ -1,4 +1,4 @@
# Copyright 2015, 2016 IBM Corp.
# Copyright 2015, 2017 IBM Corp.
#
# All Rights Reserved.
#
@ -241,7 +241,7 @@ class LiveMigrationDest(LiveMigration):
LOG.info(_LI('Performing detach for volume %(volume)s'),
dict(volume=vol_drv.volume_id), instance=self.instance)
# Ensure the volume data is present before trying cleanup
if self.pre_live_vol_data:
if hasattr(self, 'pre_live_vol_data'):
try:
vol_drv.cleanup_volume_at_destination(self.pre_live_vol_data)
except Exception: