Drop API compat handling for old compute error cases

Change Ibcb6bf912b3fb69c8631665fef2832906ba338aa dropped
the compute RPC API code for checking old computes from the
API and raising specific errors if the API is trying to perform
some action on an instance running on an old compute that can't
handle that action.

With that change, the API now expects that computes should be
able to handle at least Queens level operations, i.e. the
can_send_version checks for those operations in the compute RPC
API code would not be False.

Since those compute RPC API checks are removed, the handling in
the API is dead code now, so we can cleanup that handling.

Change-Id: Ibd05139c5f6a0548f17e24d3807746b93d76f446
This commit is contained in:
Matt Riedemann 2018-02-20 12:47:45 -05:00
parent 7bdb7dbbdd
commit 26f000ebb9
11 changed files with 7 additions and 49 deletions

View File

@ -137,7 +137,7 @@ class InterfaceAttachmentController(wsgi.Controller):
exception.PortNotUsable,
exception.AttachInterfaceNotSupported,
exception.SecurityGroupCannotBeApplied,
exception.TaggedAttachmentNotSupported) as e:
exception.NetworkInterfaceTaggedAttachNotSupported) as e:
raise exc.HTTPBadRequest(explanation=e.format_message())
except (exception.InstanceIsLocked,
exception.FixedIpAlreadyInUse,

View File

@ -115,8 +115,7 @@ class MigrateServerController(wsgi.Controller):
exception.InvalidLocalStorage,
exception.InvalidSharedStorage,
exception.HypervisorUnavailable,
exception.MigrationPreCheckError,
exception.LiveMigrationWithOldNovaNotSupported) as ex:
exception.MigrationPreCheckError) as ex:
if async:
with excutils.save_and_reraise_exception():
LOG.error("Unexpected exception received from "

View File

@ -21,7 +21,6 @@ from nova.api.openstack.compute.views import server_diagnostics
from nova.api.openstack import wsgi
from nova import compute
from nova import exception
from nova.i18n import _
from nova.policies import server_diagnostics as sd_policies
@ -51,16 +50,5 @@ class ServerDiagnosticsController(wsgi.Controller):
'get_diagnostics', server_id)
except exception.InstanceNotReady as e:
raise webob.exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceDiagnosticsNotSupported:
# NOTE(snikitin): During upgrade we may face situation when env
# has new API and old compute. New compute returns a
# Diagnostics object. Old compute returns a dictionary. So we
# can't perform a request correctly if compute is too old.
msg = _('Compute node is too old. You must complete the '
'upgrade process to be able to get standardized '
'diagnostics data which is available since v2.48. However '
'you are still able to get diagnostics data in '
'non-standardized format which is available until v2.47.')
raise webob.exc.HTTPBadRequest(explanation=msg)
except NotImplementedError:
common.raise_feature_not_supported()

View File

@ -1146,8 +1146,6 @@ class ServersController(wsgi.Controller):
except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error,
'trigger_crash_dump', id)
except exception.TriggerCrashDumpNotSupported as e:
raise webob.exc.HTTPBadRequest(explanation=e.format_message())
def remove_invalid_options(context, search_options, allowed_search_options):

View File

@ -348,7 +348,7 @@ class VolumeAttachmentController(wsgi.Controller):
except (exception.InvalidVolume,
exception.InvalidDevicePath,
exception.InvalidInput,
exception.TaggedAttachmentNotSupported,
exception.VolumeTaggedAttachNotSupported,
exception.MultiattachNotSupportedOldMicroversion,
exception.MultiattachToShelvedNotSupported) as e:
raise exc.HTTPBadRequest(explanation=e.format_message())

View File

@ -255,7 +255,6 @@ class ComputeTaskManager(base.Base):
exception.HypervisorUnavailable,
exception.InstanceInvalidState,
exception.MigrationPreCheckError,
exception.LiveMigrationWithOldNovaNotSupported,
exception.UnsupportedPolicyException)
@targets_cell
@wrap_instance_event(prefix='conductor')
@ -432,7 +431,6 @@ class ComputeTaskManager(base.Base):
exception.HypervisorUnavailable,
exception.InstanceInvalidState,
exception.MigrationPreCheckError,
exception.LiveMigrationWithOldNovaNotSupported,
exception.MigrationSchedulerRPCError) as ex:
with excutils.save_and_reraise_exception():
# TODO(johngarbutt) - eventually need instance actions here

View File

@ -298,21 +298,17 @@ class VolumeEncryptionNotSupported(Invalid):
"volume %(volume_id)s")
class TaggedAttachmentNotSupported(Invalid):
msg_fmt = _("Tagged device attachment is not yet available.")
class VolumeTaggedAttachNotSupported(TaggedAttachmentNotSupported):
class VolumeTaggedAttachNotSupported(Invalid):
msg_fmt = _("Tagged volume attachment is not supported for this server "
"instance.")
class VolumeTaggedAttachToShelvedNotSupported(TaggedAttachmentNotSupported):
class VolumeTaggedAttachToShelvedNotSupported(VolumeTaggedAttachNotSupported):
msg_fmt = _("Tagged volume attachment is not supported for "
"shelved-offloaded instances.")
class NetworkInterfaceTaggedAttachNotSupported(TaggedAttachmentNotSupported):
class NetworkInterfaceTaggedAttachNotSupported(Invalid):
msg_fmt = _("Tagged network interface attachment is not supported for "
"this server instance.")
@ -1821,11 +1817,6 @@ class InvalidWatchdogAction(Invalid):
msg_fmt = _("Provided watchdog action (%(action)s) is not supported.")
class LiveMigrationWithOldNovaNotSupported(NovaException):
msg_fmt = _("Live migration with API v2.25 requires all the Mitaka "
"upgrade to be complete before it is available.")
class SelectionObjectsWithOldRPCVersionNotSupported(NovaException):
msg_fmt = _("Requests for Selection objects with alternates are not "
"supported in select_destinations() before RPC version 4.5; "
@ -2101,10 +2092,6 @@ class AttachInterfaceNotSupported(Invalid):
"instance %(instance_uuid)s.")
class InstanceDiagnosticsNotSupported(Invalid):
msg_fmt = _("Instance diagnostics are not supported by compute node.")
class InvalidReservedMemoryPagesOption(Invalid):
msg_fmt = _("The format of the option 'reserved_huge_pages' is invalid. "
"(found '%(conf)s') Please refer to the nova "

View File

@ -66,7 +66,7 @@ class TestInstanceNotificationSampleWithMultipleCompute(
self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
@mock.patch('nova.compute.rpcapi.ComputeAPI.pre_live_migration',
side_effect=exception.LiveMigrationWithOldNovaNotSupported())
side_effect=exception.DestinationDiskExists(path='path'))
def _test_live_migration_rollback(self, server, mock_migration):
post = {
'os-migrateLive': {

View File

@ -330,10 +330,6 @@ class MigrateServerTestsV225(MigrateServerTestsV21):
self.controller._migrate_live,
self.req, fakes.FAKE_UUID, body=body)
def test_migrate_live_migration_with_old_nova_not_supported(self):
self._test_migrate_live_failed_with_exception(
exception.LiveMigrationWithOldNovaNotSupported())
class MigrateServerTestsV230(MigrateServerTestsV225):
force = False

View File

@ -2607,13 +2607,6 @@ class ServersControllerTriggerCrashDumpTest(ControllerTest):
self.controller._action_trigger_crash_dump,
self.req, FAKE_UUID, body=self.body)
@mock.patch.object(compute_api.API, 'trigger_crash_dump',
side_effect=exception.TriggerCrashDumpNotSupported)
def test_trigger_crash_dump_not_supported(self, mock_trigger_crash_dump):
self.assertRaises(webob.exc.HTTPBadRequest,
self.controller._action_trigger_crash_dump,
self.req, FAKE_UUID, body=self.body)
class ServersControllerUpdateTestV219(ServersControllerUpdateTest):
def _get_request(self, body=None):

View File

@ -2132,7 +2132,6 @@ class ConductorTaskTestCase(_BaseTaskTestCase, test_compute.BaseTestCase):
state='', method=''),
exc.DestinationHypervisorTooOld(),
exc.HypervisorUnavailable(host='dummy'),
exc.LiveMigrationWithOldNovaNotSupported(),
exc.MigrationPreCheckError(reason='dummy'),
exc.InvalidSharedStorage(path='dummy', reason='dummy'),
exc.NoValidHost(reason='dummy'),