Stop handling 'InstanceUnknownCell' exception

This was only raised by cells v1 code and therefore no longer needs to be
handled. A future change will remove the exception itself.

Part of blueprint remove-cells-v1

Change-Id: I1dd6abcc2be17ff76f108e7ff3771314f33259c6
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane
2019-04-05 15:16:46 +01:00
parent d4f58f5eb6
commit 95dc5d0ab5
17 changed files with 8 additions and 92 deletions

View File

@@ -44,8 +44,6 @@ class AdminActionsController(wsgi.Controller):
instance = common.get_instance(self.compute_api, context, id) instance = common.get_instance(self.compute_api, context, id)
try: try:
self.compute_api.reset_network(context, instance) self.compute_api.reset_network(context, instance)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
@@ -59,8 +57,6 @@ class AdminActionsController(wsgi.Controller):
instance = common.get_instance(self.compute_api, context, id) instance = common.get_instance(self.compute_api, context, id)
try: try:
self.compute_api.inject_network_info(context, instance) self.compute_api.inject_network_info(context, instance)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())

View File

@@ -47,8 +47,6 @@ class AdminPasswordController(wsgi.Controller):
password = body['changePassword']['adminPass'] password = body['changePassword']['adminPass']
try: try:
self.compute_api.set_admin_password(context, instance, password) self.compute_api.set_admin_password(context, instance, password)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except (exception.InstancePasswordSetFailed, except (exception.InstancePasswordSetFailed,
exception.SetAdminPasswdNotSupported, exception.SetAdminPasswdNotSupported,
exception.InstanceAgentNotEnabled) as e: exception.InstanceAgentNotEnabled) as e:

View File

@@ -68,8 +68,6 @@ class CreateBackupController(wsgi.Controller):
try: try:
image = self.compute_api.backup(context, instance, image_name, image = self.compute_api.backup(context, instance, image_name,
backup_type, rotation, extra_properties=props) backup_type, rotation, extra_properties=props)
except exception.InstanceUnknownCell as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error, common.raise_http_conflict_for_instance_invalid_state(state_error,
'createBackup', id) 'createBackup', id)

View File

@@ -39,8 +39,6 @@ class DeferredDeleteController(wsgi.Controller):
instance = common.get_instance(self.compute_api, context, id) instance = common.get_instance(self.compute_api, context, id)
try: try:
self.compute_api.restore(context, instance) self.compute_api.restore(context, instance)
except exception.InstanceUnknownCell as error:
raise webob.exc.HTTPNotFound(explanation=error.format_message())
except exception.QuotaError as error: except exception.QuotaError as error:
raise webob.exc.HTTPForbidden(explanation=error.format_message()) raise webob.exc.HTTPForbidden(explanation=error.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
@@ -59,8 +57,7 @@ class DeferredDeleteController(wsgi.Controller):
'project_id': instance.project_id}) 'project_id': instance.project_id})
try: try:
self.compute_api.force_delete(context, instance) self.compute_api.force_delete(context, instance)
except (exception.InstanceNotFound, except exception.InstanceNotFound as e:
exception.InstanceUnknownCell) as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message()) raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise webob.exc.HTTPConflict(explanation=e.format_message()) raise webob.exc.HTTPConflict(explanation=e.format_message())

View File

@@ -132,8 +132,6 @@ class EvacuateController(wsgi.Controller):
try: try:
self.compute_api.evacuate(context, instance, host, self.compute_api.evacuate(context, instance, host,
on_shared_storage, password, force) on_shared_storage, password, force)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error, common.raise_http_conflict_for_instance_invalid_state(state_error,
'evacuate', id) 'evacuate', id)

View File

@@ -272,8 +272,6 @@ class FloatingIPActionController(wsgi.Controller):
except exception.NoFloatingIpInterface: except exception.NoFloatingIpInterface:
msg = _('l3driver call to add floating IP failed') msg = _('l3driver call to add floating IP failed')
raise webob.exc.HTTPBadRequest(explanation=msg) raise webob.exc.HTTPBadRequest(explanation=msg)
except exception.InstanceUnknownCell as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.FloatingIpNotFoundForAddress: except exception.FloatingIpNotFoundForAddress:
msg = _('floating IP not found') msg = _('floating IP not found')
raise webob.exc.HTTPNotFound(explanation=msg) raise webob.exc.HTTPNotFound(explanation=msg)

View File

@@ -139,8 +139,6 @@ class MigrateServerController(wsgi.Controller):
self.compute_api.live_migrate(context, instance, block_migration, self.compute_api.live_migrate(context, instance, block_migration,
disk_over_commit, host, force, disk_over_commit, host, force,
async_) async_)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except (exception.NoValidHost, except (exception.NoValidHost,
exception.ComputeServiceUnavailable, exception.ComputeServiceUnavailable,
exception.InvalidHypervisorType, exception.InvalidHypervisorType,

View File

@@ -47,8 +47,6 @@ class MultinicController(wsgi.Controller):
network_id = body['addFixedIp']['networkId'] network_id = body['addFixedIp']['networkId']
try: try:
self.compute_api.add_fixed_ip(context, instance, network_id) self.compute_api.add_fixed_ip(context, instance, network_id)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.NoMoreFixedIps as e: except exception.NoMoreFixedIps as e:
raise exc.HTTPBadRequest(explanation=e.format_message()) raise exc.HTTPBadRequest(explanation=e.format_message())
@@ -67,7 +65,5 @@ class MultinicController(wsgi.Controller):
try: try:
self.compute_api.remove_fixed_ip(context, instance, address) self.compute_api.remove_fixed_ip(context, instance, address)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.FixedIpNotFoundForSpecificInstance as e: except exception.FixedIpNotFoundForSpecificInstance as e:
raise exc.HTTPBadRequest(explanation=e.format_message()) raise exc.HTTPBadRequest(explanation=e.format_message())

View File

@@ -44,8 +44,7 @@ class PauseServerController(wsgi.Controller):
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error, common.raise_http_conflict_for_instance_invalid_state(state_error,
'pause', id) 'pause', id)
except (exception.InstanceUnknownCell, except exception.InstanceNotFound as e:
exception.InstanceNotFound) as e:
raise exc.HTTPNotFound(explanation=e.format_message()) raise exc.HTTPNotFound(explanation=e.format_message())
except NotImplementedError: except NotImplementedError:
common.raise_feature_not_supported() common.raise_feature_not_supported()
@@ -65,8 +64,7 @@ class PauseServerController(wsgi.Controller):
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error, common.raise_http_conflict_for_instance_invalid_state(state_error,
'unpause', id) 'unpause', id)
except (exception.InstanceUnknownCell, except exception.InstanceNotFound as e:
exception.InstanceNotFound) as e:
raise exc.HTTPNotFound(explanation=e.format_message()) raise exc.HTTPNotFound(explanation=e.format_message())
except NotImplementedError: except NotImplementedError:
common.raise_feature_not_supported() common.raise_feature_not_supported()

View File

@@ -52,8 +52,7 @@ class RemoteConsolesController(wsgi.Controller):
console_type) console_type)
except exception.ConsoleTypeUnavailable as e: except exception.ConsoleTypeUnavailable as e:
raise webob.exc.HTTPBadRequest(explanation=e.format_message()) raise webob.exc.HTTPBadRequest(explanation=e.format_message())
except (exception.InstanceUnknownCell, except exception.InstanceNotFound as e:
exception.InstanceNotFound) as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message()) raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceNotReady as e: except exception.InstanceNotReady as e:
raise webob.exc.HTTPConflict(explanation=e.format_message()) raise webob.exc.HTTPConflict(explanation=e.format_message())
@@ -81,8 +80,7 @@ class RemoteConsolesController(wsgi.Controller):
console_type) console_type)
except exception.ConsoleTypeUnavailable as e: except exception.ConsoleTypeUnavailable as e:
raise webob.exc.HTTPBadRequest(explanation=e.format_message()) raise webob.exc.HTTPBadRequest(explanation=e.format_message())
except (exception.InstanceUnknownCell, except exception.InstanceNotFound as e:
exception.InstanceNotFound) as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message()) raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceNotReady as e: except exception.InstanceNotReady as e:
raise webob.exc.HTTPConflict(explanation=e.format_message()) raise webob.exc.HTTPConflict(explanation=e.format_message())
@@ -112,8 +110,7 @@ class RemoteConsolesController(wsgi.Controller):
console_type) console_type)
except exception.ConsoleTypeUnavailable as e: except exception.ConsoleTypeUnavailable as e:
raise webob.exc.HTTPBadRequest(explanation=e.format_message()) raise webob.exc.HTTPBadRequest(explanation=e.format_message())
except (exception.InstanceUnknownCell, except exception.InstanceNotFound as e:
exception.InstanceNotFound) as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message()) raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceNotReady as e: except exception.InstanceNotReady as e:
raise webob.exc.HTTPConflict(explanation=e.format_message()) raise webob.exc.HTTPConflict(explanation=e.format_message())
@@ -138,8 +135,7 @@ class RemoteConsolesController(wsgi.Controller):
output = self.compute_api.get_serial_console(context, output = self.compute_api.get_serial_console(context,
instance, instance,
console_type) console_type)
except (exception.InstanceUnknownCell, except exception.InstanceNotFound as e:
exception.InstanceNotFound) as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message()) raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceNotReady as e: except exception.InstanceNotReady as e:
raise webob.exc.HTTPConflict(explanation=e.format_message()) raise webob.exc.HTTPConflict(explanation=e.format_message())

View File

@@ -61,8 +61,6 @@ class RescueController(wsgi.Controller):
self.compute_api.rescue(context, instance, self.compute_api.rescue(context, instance,
rescue_password=password, rescue_password=password,
rescue_image_ref=rescue_image_ref) rescue_image_ref=rescue_image_ref)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
@@ -89,8 +87,6 @@ class RescueController(wsgi.Controller):
instance = common.get_instance(self.compute_api, context, id) instance = common.get_instance(self.compute_api, context, id)
try: try:
self.compute_api.unrescue(context, instance) self.compute_api.unrescue(context, instance)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:

View File

@@ -108,16 +108,10 @@ class ServerMetadataController(wsgi.Controller):
server, server,
metadata, metadata,
delete) delete)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.QuotaError as error: except exception.QuotaError as error:
raise exc.HTTPForbidden(explanation=error.format_message()) raise exc.HTTPForbidden(explanation=error.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error, common.raise_http_conflict_for_instance_invalid_state(state_error,
'update metadata', server_id) 'update metadata', server_id)
@@ -150,13 +144,8 @@ class ServerMetadataController(wsgi.Controller):
server = common.get_instance(self.compute_api, context, server_id) server = common.get_instance(self.compute_api, context, server_id)
try: try:
self.compute_api.delete_instance_metadata(context, server, id) self.compute_api.delete_instance_metadata(context, server, id)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error, common.raise_http_conflict_for_instance_invalid_state(state_error,
'delete metadata', server_id) 'delete metadata', server_id)

View File

@@ -852,8 +852,6 @@ class ServersController(wsgi.Controller):
instance = self._get_server(context, req, id) instance = self._get_server(context, req, id)
try: try:
self.compute_api.confirm_resize(context, instance) self.compute_api.confirm_resize(context, instance)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.MigrationNotFound: except exception.MigrationNotFound:
msg = _("Instance has not been resized.") msg = _("Instance has not been resized.")
raise exc.HTTPBadRequest(explanation=msg) raise exc.HTTPBadRequest(explanation=msg)
@@ -872,8 +870,6 @@ class ServersController(wsgi.Controller):
instance = self._get_server(context, req, id) instance = self._get_server(context, req, id)
try: try:
self.compute_api.revert_resize(context, instance) self.compute_api.revert_resize(context, instance)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.MigrationNotFound: except exception.MigrationNotFound:
msg = _("Instance has not been resized.") msg = _("Instance has not been resized.")
raise exc.HTTPBadRequest(explanation=msg) raise exc.HTTPBadRequest(explanation=msg)
@@ -927,8 +923,6 @@ class ServersController(wsgi.Controller):
try: try:
self.compute_api.resize(context, instance, flavor_id, **kwargs) self.compute_api.resize(context, instance, flavor_id, **kwargs)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.QuotaError as error: except exception.QuotaError as error:
raise exc.HTTPForbidden( raise exc.HTTPForbidden(
explanation=error.format_message()) explanation=error.format_message())
@@ -967,8 +961,6 @@ class ServersController(wsgi.Controller):
except exception.InstanceNotFound: except exception.InstanceNotFound:
msg = _("Instance could not be found") msg = _("Instance could not be found")
raise exc.HTTPNotFound(explanation=msg) raise exc.HTTPNotFound(explanation=msg)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except (exception.InstanceIsLocked, except (exception.InstanceIsLocked,
exception.AllocationDeleteFailed) as e: exception.AllocationDeleteFailed) as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
@@ -1093,8 +1085,6 @@ class ServersController(wsgi.Controller):
except exception.InstanceNotFound: except exception.InstanceNotFound:
msg = _("Instance could not be found") msg = _("Instance could not be found")
raise exc.HTTPNotFound(explanation=msg) raise exc.HTTPNotFound(explanation=msg)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.ImageNotFound: except exception.ImageNotFound:
msg = _("Cannot find image for rebuild") msg = _("Cannot find image for rebuild")
raise exc.HTTPBadRequest(explanation=msg) raise exc.HTTPBadRequest(explanation=msg)
@@ -1188,8 +1178,6 @@ class ServersController(wsgi.Controller):
instance, instance,
image_name, image_name,
extra_properties=metadata) extra_properties=metadata)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error, common.raise_http_conflict_for_instance_invalid_state(state_error,
'createImage', id) 'createImage', id)
@@ -1262,8 +1250,6 @@ class ServersController(wsgi.Controller):
self.compute_api.start(context, instance) self.compute_api.start(context, instance)
except (exception.InstanceNotReady, exception.InstanceIsLocked) as e: except (exception.InstanceNotReady, exception.InstanceIsLocked) as e:
raise webob.exc.HTTPConflict(explanation=e.format_message()) raise webob.exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error, common.raise_http_conflict_for_instance_invalid_state(state_error,
'start', id) 'start', id)
@@ -1282,8 +1268,6 @@ class ServersController(wsgi.Controller):
self.compute_api.stop(context, instance) self.compute_api.stop(context, instance)
except (exception.InstanceNotReady, exception.InstanceIsLocked) as e: except (exception.InstanceNotReady, exception.InstanceIsLocked) as e:
raise webob.exc.HTTPConflict(explanation=e.format_message()) raise webob.exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error, common.raise_http_conflict_for_instance_invalid_state(state_error,
'stop', id) 'stop', id)

View File

@@ -45,8 +45,6 @@ class ShelveController(wsgi.Controller):
'project_id': instance.project_id}) 'project_id': instance.project_id})
try: try:
self.compute_api.shelve(context, instance) self.compute_api.shelve(context, instance)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
@@ -64,8 +62,6 @@ class ShelveController(wsgi.Controller):
instance = common.get_instance(self.compute_api, context, id) instance = common.get_instance(self.compute_api, context, id)
try: try:
self.compute_api.shelve_offload(context, instance) self.compute_api.shelve_offload(context, instance)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
@@ -98,8 +94,6 @@ class ShelveController(wsgi.Controller):
try: try:
self.compute_api.unshelve(context, instance) self.compute_api.unshelve(context, instance)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:

View File

@@ -38,8 +38,6 @@ class SuspendServerController(wsgi.Controller):
target={'user_id': server.user_id, target={'user_id': server.user_id,
'project_id': server.project_id}) 'project_id': server.project_id})
self.compute_api.suspend(context, server) self.compute_api.suspend(context, server)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:
@@ -56,8 +54,6 @@ class SuspendServerController(wsgi.Controller):
server = common.get_instance(self.compute_api, context, id) server = common.get_instance(self.compute_api, context, id)
try: try:
self.compute_api.resume(context, server) self.compute_api.resume(context, server)
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message()) raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error: except exception.InstanceInvalidState as state_error:

View File

@@ -335,8 +335,7 @@ class VolumeAttachmentController(wsgi.Controller):
device = self.compute_api.attach_volume( device = self.compute_api.attach_volume(
context, instance, volume_id, device, tag=tag, context, instance, volume_id, device, tag=tag,
supports_multiattach=supports_multiattach) supports_multiattach=supports_multiattach)
except (exception.InstanceUnknownCell, except exception.VolumeNotFound as e:
exception.VolumeNotFound) as e:
raise exc.HTTPNotFound(explanation=e.format_message()) raise exc.HTTPNotFound(explanation=e.format_message())
except (exception.InstanceIsLocked, except (exception.InstanceIsLocked,
exception.DevicePathInUse, exception.DevicePathInUse,
@@ -448,8 +447,6 @@ class VolumeAttachmentController(wsgi.Controller):
self.compute_api.detach_volume(context, instance, volume) self.compute_api.detach_volume(context, instance, volume)
except exception.InvalidVolume as e: except exception.InvalidVolume as e:
raise exc.HTTPBadRequest(explanation=e.format_message()) raise exc.HTTPBadRequest(explanation=e.format_message())
except exception.InstanceUnknownCell as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InvalidInput as e: except exception.InvalidInput as e:
raise exc.HTTPBadRequest(explanation=e.format_message()) raise exc.HTTPBadRequest(explanation=e.format_message())
except exception.InstanceIsLocked as e: except exception.InstanceIsLocked as e:

View File

@@ -104,19 +104,6 @@ class DeferredDeleteExtensionTestV21(test.NoDBTestCase):
self.assertIn('Instance fake_uuid could not be found', self.assertIn('Instance fake_uuid could not be found',
ex.explanation) ex.explanation)
@mock.patch.object(compute_api.API, 'get')
@mock.patch.object(compute_api.API, 'force_delete',
side_effect=exception.InstanceUnknownCell(
instance_uuid='fake_uuid'))
def test_force_delete_instance_cellunknown(self, mock_force_delete,
mock_get):
req = fakes.HTTPRequest.blank('/v2/fake/servers/fake_uuid/action')
ex = self.assertRaises(webob.exc.HTTPNotFound,
self.extension._force_delete,
req, 'fake_uuid', '')
self.assertIn('Cell is not known for instance fake_uuid',
ex.explanation)
@mock.patch.object(compute_api.API, 'get') @mock.patch.object(compute_api.API, 'get')
@mock.patch.object(compute_api.API, 'restore') @mock.patch.object(compute_api.API, 'restore')
def test_restore(self, mock_restore, mock_get): def test_restore(self, mock_restore, mock_get):