Remove compute compat checks for aborting queued live migrations

These were added in Rocky [1] and can now been removed, since we don't
need to support anything from before Train in Ussuri.

[1] I4636a8d270ce01c1831bc951c4497ad472bc9aa8

Change-Id: Ib01ebeff0647f6e27714856f3a36c3896eeab27f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2019-10-14 15:08:41 +01:00 committed by Matt Riedemann
parent 4ac308f0ae
commit 8d5172dadc
5 changed files with 1 additions and 61 deletions

View File

@ -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())

View File

@ -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:

View File

@ -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")

View File

@ -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'

View File

@ -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):