diff --git a/nova/api/openstack/compute/server_migrations.py b/nova/api/openstack/compute/server_migrations.py index 6f92ac99bc..c1bfba7356 100644 --- a/nova/api/openstack/compute/server_migrations.py +++ b/nova/api/openstack/compute/server_migrations.py @@ -160,5 +160,3 @@ class ServerMigrationsController(wsgi.Controller): raise exc.HTTPNotFound(explanation=e.format_message()) except exception.InvalidMigrationState as e: raise exc.HTTPBadRequest(explanation=e.format_message()) - except exception.AbortQueuedLiveMigrationNotYetSupported as e: - raise exc.HTTPConflict(explanation=e.format_message()) diff --git a/nova/compute/api.py b/nova/compute/api.py index 5765fa361e..bca8d7c226 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -103,7 +103,7 @@ AGGREGATE_ACTION_UPDATE = 'Update' AGGREGATE_ACTION_UPDATE_META = 'UpdateMeta' AGGREGATE_ACTION_DELETE = 'Delete' AGGREGATE_ACTION_ADD = 'Add' -MIN_COMPUTE_ABORT_QUEUED_LIVE_MIGRATION = 34 + MIN_COMPUTE_SYNC_COMPUTE_STATUS_DISABLED = 38 # FIXME(danms): Keep a global cache of the cells we find the @@ -4573,15 +4573,6 @@ class API(base.Base): # compute service hosting the instance is new enough to support # aborting a queued/preparing live migration, so we check the # service version here. - # TODO(Kevin_Zheng): This service version check can be removed in - # Stein (at the earliest) when the API only supports Rocky or - # newer computes. - if migration.status in queued_states: - service = objects.Service.get_by_compute_host( - context, instance.host) - if service.version < MIN_COMPUTE_ABORT_QUEUED_LIVE_MIGRATION: - raise exception.AbortQueuedLiveMigrationNotYetSupported( - migration_id=migration_id, status=migration.status) allowed_states.extend(queued_states) if migration.status not in allowed_states: diff --git a/nova/exception.py b/nova/exception.py index 201c64b64a..ddf99aae52 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -1197,12 +1197,6 @@ class InvalidMigrationState(Invalid): "migration is in this state.") -class AbortQueuedLiveMigrationNotYetSupported(NovaException): - msg_fmt = _("Aborting live migration %(migration_id)s with status " - "%(status)s is not yet supported for this instance.") - code = 409 - - class ConsoleLogOutputException(NovaException): msg_fmt = _("Console log output could not be retrieved for instance " "%(instance_id)s. Reason: %(reason)s") diff --git a/nova/tests/unit/api/openstack/compute/test_server_migrations.py b/nova/tests/unit/api/openstack/compute/test_server_migrations.py index 35d6a5db01..06636ffcea 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_migrations.py +++ b/nova/tests/unit/api/openstack/compute/test_server_migrations.py @@ -18,7 +18,6 @@ import datetime import mock from oslo_utils.fixture import uuidsentinel as uuids -import six import webob from nova.api.openstack.compute import server_migrations @@ -348,25 +347,6 @@ class ServerMigrationsTestsV265(ServerMigrationsTestsV224): support_abort_in_queue=True) _do_test() - def test_cancel_live_migration_in_queue_not_yet_available(self): - exc = exception.AbortQueuedLiveMigrationNotYetSupported( - migration_id=1, status='queued') - - @mock.patch.object(self.compute_api, 'live_migrate_abort', - side_effect=exc) - @mock.patch.object(self.compute_api, 'get') - def _do_test(mock_get, mock_abort): - error = self.assertRaises(webob.exc.HTTPConflict, - self.controller.delete, - self.req, 'server-id', 1) - self.assertIn("Aborting live migration 1 with status queued is " - "not yet supported for this instance.", - six.text_type(error)) - mock_abort.assert_called_once_with(self.context, - mock_get.return_value, 1, - support_abort_in_queue=True) - _do_test() - class ServerMigrationsPolicyEnforcementV21(test.NoDBTestCase): wsgi_api_version = '2.22' diff --git a/nova/tests/unit/compute/test_compute_api.py b/nova/tests/unit/compute/test_compute_api.py index e037f8266d..7bb72c1b67 100644 --- a/nova/tests/unit/compute/test_compute_api.py +++ b/nova/tests/unit/compute/test_compute_api.py @@ -5214,16 +5214,10 @@ class _ComputeAPIUnitTestMixIn(object): @mock.patch('nova.compute.api.API._record_action_start') @mock.patch.object(compute_rpcapi.ComputeAPI, 'live_migration_abort') @mock.patch.object(objects.Migration, 'get_by_id_and_instance') - @mock.patch.object(objects.Service, 'get_by_compute_host') def test_live_migrate_abort_in_queue_succeeded(self, - mock_get_service, mock_get_migration, mock_lm_abort, mock_rec_action): - service_obj = objects.Service() - service_obj.version = ( - compute_api.MIN_COMPUTE_ABORT_QUEUED_LIVE_MIGRATION) - mock_get_service.return_value = service_obj instance = self._create_instance_obj() instance.task_state = task_states.MIGRATING for migration_status in ('queued', 'preparing'): @@ -5254,23 +5248,6 @@ class _ComputeAPIUnitTestMixIn(object): instance, migration.id, support_abort_in_queue=False) - @mock.patch.object(objects.Migration, 'get_by_id_and_instance') - @mock.patch.object(objects.Service, 'get_by_compute_host') - def test_live_migration_abort_in_queue_old_compute_conflict( - self, mock_get_service, mock_get_migration): - service_obj = objects.Service() - service_obj.version = ( - compute_api.MIN_COMPUTE_ABORT_QUEUED_LIVE_MIGRATION - 1) - mock_get_service.return_value = service_obj - instance = self._create_instance_obj() - instance.task_state = task_states.MIGRATING - migration = self._get_migration(21, 'queued', 'live-migration') - mock_get_migration.return_value = migration - self.assertRaises(exception.AbortQueuedLiveMigrationNotYetSupported, - self.compute_api.live_migrate_abort, self.context, - instance, migration.id, - support_abort_in_queue=True) - @mock.patch.object(objects.Migration, 'get_by_id_and_instance') def test_live_migration_abort_wrong_migration_status(self, mock_get_migration):