API: Handle InstanceUnknownCell exceptions
There are some methods in Nova compute api and cell api would call the decorator `check_instance_cell`, and that decorator may raise InstanceUnknownCell, there isn't any exception handler in REST api layer. This patch adds handlers for those methods. Closes-bug: #1484776 Change-Id: I753a81f093ec5fdf000841949e52fca6f2662aa8
This commit is contained in:
parent
1db33ca6c2
commit
cbcf5932be
|
@ -48,6 +48,8 @@ class AdminActionsController(wsgi.Controller):
|
||||||
try:
|
try:
|
||||||
instance = common.get_instance(self.compute_api, context, id)
|
instance = common.get_instance(self.compute_api, context, id)
|
||||||
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())
|
||||||
|
|
||||||
|
@ -61,6 +63,8 @@ class AdminActionsController(wsgi.Controller):
|
||||||
try:
|
try:
|
||||||
instance = common.get_instance(self.compute_api, context, id)
|
instance = common.get_instance(self.compute_api, context, id)
|
||||||
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())
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ class AdminPasswordController(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.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 as e:
|
except exception.InstancePasswordSetFailed as e:
|
||||||
raise exc.HTTPConflict(explanation=e.format_message())
|
raise exc.HTTPConflict(explanation=e.format_message())
|
||||||
except exception.InstanceInvalidState as e:
|
except exception.InstanceInvalidState as e:
|
||||||
|
|
|
@ -66,6 +66,8 @@ 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)
|
||||||
|
|
|
@ -42,6 +42,8 @@ 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:
|
||||||
|
|
|
@ -86,6 +86,8 @@ class EvacuateController(wsgi.Controller):
|
||||||
try:
|
try:
|
||||||
self.compute_api.evacuate(context, instance, host,
|
self.compute_api.evacuate(context, instance, host,
|
||||||
on_shared_storage, password)
|
on_shared_storage, password)
|
||||||
|
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)
|
||||||
|
|
|
@ -242,6 +242,8 @@ 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)
|
||||||
|
|
|
@ -80,6 +80,8 @@ class MigrateServerController(wsgi.Controller):
|
||||||
instance = common.get_instance(self.compute_api, context, id)
|
instance = common.get_instance(self.compute_api, context, id)
|
||||||
self.compute_api.live_migrate(context, instance, block_migration,
|
self.compute_api.live_migrate(context, instance, block_migration,
|
||||||
disk_over_commit, host)
|
disk_over_commit, host)
|
||||||
|
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,
|
||||||
|
|
|
@ -48,6 +48,8 @@ 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())
|
||||||
|
|
||||||
|
@ -65,6 +67,8 @@ 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())
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,8 @@ 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.InstanceNotFound as e:
|
except (exception.InstanceUnknownCell,
|
||||||
|
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()
|
||||||
|
@ -66,7 +67,8 @@ 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.InstanceNotFound as e:
|
except (exception.InstanceUnknownCell,
|
||||||
|
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()
|
||||||
|
|
|
@ -56,7 +56,8 @@ 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.InstanceNotFound as e:
|
except (exception.InstanceUnknownCell,
|
||||||
|
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())
|
||||||
|
@ -84,7 +85,8 @@ 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.InstanceNotFound as e:
|
except (exception.InstanceUnknownCell,
|
||||||
|
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())
|
||||||
|
@ -114,7 +116,8 @@ 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.InstanceNotFound as e:
|
except (exception.InstanceUnknownCell,
|
||||||
|
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())
|
||||||
|
@ -139,7 +142,8 @@ 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.InstanceNotFound as e:
|
except (exception.InstanceUnknownCell,
|
||||||
|
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())
|
||||||
|
|
|
@ -65,6 +65,8 @@ 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:
|
||||||
|
@ -91,6 +93,8 @@ 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:
|
||||||
|
|
|
@ -112,6 +112,9 @@ class ServerMetadataController(wsgi.Controller):
|
||||||
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())
|
||||||
|
|
||||||
|
@ -151,6 +154,9 @@ class ServerMetadataController(wsgi.Controller):
|
||||||
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())
|
||||||
|
|
||||||
|
|
|
@ -792,6 +792,8 @@ 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)
|
||||||
|
@ -810,6 +812,8 @@ 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)
|
||||||
|
@ -849,6 +853,8 @@ 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(),
|
||||||
|
@ -891,6 +897,8 @@ 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 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:
|
||||||
|
@ -995,6 +1003,8 @@ 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)
|
||||||
|
@ -1055,6 +1065,8 @@ 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)
|
||||||
|
@ -1107,6 +1119,8 @@ 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)
|
||||||
|
@ -1124,6 +1138,8 @@ 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)
|
||||||
|
|
|
@ -43,6 +43,8 @@ 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(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:
|
||||||
|
@ -60,6 +62,8 @@ 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:
|
||||||
|
@ -77,6 +81,8 @@ 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.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:
|
||||||
|
|
|
@ -41,6 +41,8 @@ class SuspendServerController(wsgi.Controller):
|
||||||
try:
|
try:
|
||||||
server = common.get_instance(self.compute_api, context, id)
|
server = common.get_instance(self.compute_api, context, 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:
|
||||||
|
@ -57,6 +59,8 @@ class SuspendServerController(wsgi.Controller):
|
||||||
try:
|
try:
|
||||||
server = common.get_instance(self.compute_api, context, id)
|
server = common.get_instance(self.compute_api, context, id)
|
||||||
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:
|
||||||
|
|
|
@ -281,6 +281,8 @@ class VolumeAttachmentController(wsgi.Controller):
|
||||||
try:
|
try:
|
||||||
device = self.compute_api.attach_volume(context, instance,
|
device = self.compute_api.attach_volume(context, instance,
|
||||||
volume_id, device)
|
volume_id, device)
|
||||||
|
except exception.InstanceUnknownCell as e:
|
||||||
|
raise exc.HTTPNotFound(explanation=e.format_message())
|
||||||
except exception.VolumeNotFound as e:
|
except exception.VolumeNotFound as e:
|
||||||
raise exc.HTTPNotFound(explanation=e.format_message())
|
raise exc.HTTPNotFound(explanation=e.format_message())
|
||||||
except exception.InstanceIsLocked as e:
|
except exception.InstanceIsLocked as e:
|
||||||
|
@ -399,6 +401,8 @@ class VolumeAttachmentController(wsgi.Controller):
|
||||||
pass
|
pass
|
||||||
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.InstanceIsLocked as e:
|
except exception.InstanceIsLocked as e:
|
||||||
raise exc.HTTPConflict(explanation=e.format_message())
|
raise exc.HTTPConflict(explanation=e.format_message())
|
||||||
|
|
Loading…
Reference in New Issue