Merge "Avoid error state for recovered instances after failed migrations"
This commit is contained in:
commit
006dfc48e6
|
@ -66,18 +66,7 @@ class LiveMigrationOpsTestCase(test_base.HyperVBaseTestCase):
|
|||
else:
|
||||
migrate_data = None
|
||||
|
||||
if side_effect is os_win_exc.HyperVException:
|
||||
self.assertRaises(os_win_exc.HyperVException,
|
||||
self._livemigrops.live_migration,
|
||||
self.context, mock_instance, fake_dest,
|
||||
mock_post, mock_recover,
|
||||
mock.sentinel.block_migr,
|
||||
migrate_data)
|
||||
mock_recover.assert_called_once_with(self.context, mock_instance,
|
||||
fake_dest,
|
||||
migrate_data)
|
||||
else:
|
||||
self._livemigrops.live_migration(context=self.context,
|
||||
self._livemigrops.live_migration(context=self.context,
|
||||
instance_ref=mock_instance,
|
||||
dest=fake_dest,
|
||||
post_method=mock_post,
|
||||
|
@ -85,6 +74,13 @@ class LiveMigrationOpsTestCase(test_base.HyperVBaseTestCase):
|
|||
block_migration=(
|
||||
mock.sentinel.block_migr),
|
||||
migrate_data=migrate_data)
|
||||
|
||||
if side_effect is os_win_exc.HyperVException:
|
||||
mock_recover.assert_called_once_with(self.context, mock_instance,
|
||||
fake_dest,
|
||||
migrate_data)
|
||||
mock_post.assert_not_called()
|
||||
else:
|
||||
post_call_args = mock_post.call_args_list
|
||||
self.assertEqual(1, len(post_call_args))
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ Management class for live migration VM operations.
|
|||
|
||||
from os_win import utilsfactory
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
|
@ -78,10 +77,10 @@ class LiveMigrationOps(object):
|
|||
dest,
|
||||
migrate_disks=not shared_storage)
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.debug("Calling live migration recover_method "
|
||||
"for instance: %s", instance_name)
|
||||
recover_method(context, instance_ref, dest, migrate_data)
|
||||
LOG.exception("Live migration failed. Attempting rollback.",
|
||||
instance=instance_ref)
|
||||
recover_method(context, instance_ref, dest, migrate_data)
|
||||
return
|
||||
|
||||
LOG.debug("Calling live migration post_method for instance: %s",
|
||||
instance_name)
|
||||
|
|
Loading…
Reference in New Issue