Fix live migration api stuck when migrate to old nova node
Commit bc45c56f10
disable instance
live migration between different verison node. If the two nodes
with different rpc version, will raise exception
LiveMigrationWithOldNovaNotSafe. But this exception didn't catch
as expected exception, that make the instance status stuck at
migrating. This patch add LiveMigrationWithOldNovaNotSafe as
expected exception.
Change-Id: I1dcee9181fd0ef293628b30766112f00792796ab
Closes-Bug: #1377644
This commit is contained in:
parent
89cd6a0c49
commit
af43e17f03
|
@ -348,7 +348,8 @@ class AdminActionsController(wsgi.Controller):
|
|||
exception.InvalidSharedStorage,
|
||||
exception.HypervisorUnavailable,
|
||||
exception.InstanceNotRunning,
|
||||
exception.MigrationPreCheckError) as ex:
|
||||
exception.MigrationPreCheckError,
|
||||
exception.LiveMigrationWithOldNovaNotSafe) as ex:
|
||||
raise exc.HTTPBadRequest(explanation=ex.format_message())
|
||||
except exception.InstanceNotFound as e:
|
||||
raise exc.HTTPNotFound(explanation=e.format_message())
|
||||
|
|
|
@ -94,7 +94,8 @@ class MigrateServerController(wsgi.Controller):
|
|||
exception.InvalidSharedStorage,
|
||||
exception.HypervisorUnavailable,
|
||||
exception.InstanceNotRunning,
|
||||
exception.MigrationPreCheckError) as ex:
|
||||
exception.MigrationPreCheckError,
|
||||
exception.LiveMigrationWithOldNovaNotSafe) as ex:
|
||||
raise exc.HTTPBadRequest(explanation=ex.format_message())
|
||||
except exception.InstanceIsLocked as e:
|
||||
raise exc.HTTPConflict(explanation=e.format_message())
|
||||
|
|
|
@ -466,7 +466,8 @@ class ComputeTaskManager(base.Base):
|
|||
exception.InvalidSharedStorage,
|
||||
exception.HypervisorUnavailable,
|
||||
exception.InstanceNotRunning,
|
||||
exception.MigrationPreCheckError)
|
||||
exception.MigrationPreCheckError,
|
||||
exception.LiveMigrationWithOldNovaNotSafe)
|
||||
def migrate_server(self, context, instance, scheduler_hint, live, rebuild,
|
||||
flavor, block_migration, disk_over_commit, reservations=None):
|
||||
if instance and not isinstance(instance, nova_object.NovaObject):
|
||||
|
@ -570,7 +571,8 @@ class ComputeTaskManager(base.Base):
|
|||
exception.InvalidSharedStorage,
|
||||
exception.HypervisorUnavailable,
|
||||
exception.InstanceNotRunning,
|
||||
exception.MigrationPreCheckError) as ex:
|
||||
exception.MigrationPreCheckError,
|
||||
exception.LiveMigrationWithOldNovaNotSafe) as ex:
|
||||
with excutils.save_and_reraise_exception():
|
||||
# TODO(johngarbutt) - eventually need instance actions here
|
||||
request_spec = {'instance_properties': {
|
||||
|
|
|
@ -416,6 +416,10 @@ class AdminActionsTestV2(AdminActionsTestV21):
|
|||
self._test_migrate_live_failed_with_exception(
|
||||
exception.MigrationPreCheckError(reason=''))
|
||||
|
||||
def test_migrate_live_migration_with_old_nova_not_safe(self):
|
||||
self._test_migrate_live_failed_with_exception(
|
||||
exception.LiveMigrationWithOldNovaNotSafe(server=''))
|
||||
|
||||
def test_unlock_not_authorized(self):
|
||||
self.mox.StubOutWithMock(self.compute_api, 'unlock')
|
||||
|
||||
|
|
|
@ -229,3 +229,7 @@ class MigrateServerTests(admin_only_action_common.CommonTests):
|
|||
def test_migrate_live_pre_check_error(self):
|
||||
self._test_migrate_live_failed_with_exception(
|
||||
exception.MigrationPreCheckError(reason=''))
|
||||
|
||||
def test_migrate_live_migration_with_old_nova_not_safe(self):
|
||||
self._test_migrate_live_failed_with_exception(
|
||||
exception.LiveMigrationWithOldNovaNotSafe(server=''))
|
||||
|
|
|
@ -1731,6 +1731,10 @@ class ConductorTaskTestCase(_BaseTaskTestCase, test_compute.BaseTestCase):
|
|||
ex = exc.HypervisorUnavailable(host='dummy')
|
||||
self._test_migrate_server_deals_with_expected_exceptions(ex)
|
||||
|
||||
def test_migrate_server_deals_with_LiveMigrationWithOldNovaNotSafe(self):
|
||||
ex = exc.LiveMigrationWithOldNovaNotSafe(server='dummy')
|
||||
self._test_migrate_server_deals_with_expected_exceptions(ex)
|
||||
|
||||
def test_migrate_server_deals_with_unexpected_exceptions(self):
|
||||
instance = fake_instance.fake_db_instance()
|
||||
inst_obj = objects.Instance._from_db_object(
|
||||
|
|
Loading…
Reference in New Issue