Merge "Drop API compat handling for old compute error cases"

This commit is contained in:
Zuul 2018-06-27 14:24:02 +00:00 committed by Gerrit Code Review
commit c8b93fa249
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

@ -1182,8 +1182,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')
@ -433,7 +432,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

@ -303,21 +303,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.")
@ -1831,11 +1827,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; "
@ -2111,10 +2102,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

@ -333,10 +333,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

@ -2801,13 +2801,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

@ -2104,7 +2104,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'),