Merge "Remove redundant code"

This commit is contained in:
Jenkins
2017-04-26 12:29:16 +00:00
committed by Gerrit Code Review
3 changed files with 8 additions and 12 deletions

View File

@@ -62,9 +62,8 @@ class DeferredDeleteController(wsgi.Controller):
'project_id': instance.project_id})
try:
self.compute_api.force_delete(context, instance)
except exception.InstanceNotFound as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceUnknownCell as e:
except (exception.InstanceNotFound,
exception.InstanceUnknownCell) as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e:
raise webob.exc.HTTPConflict(explanation=e.format_message())

View File

@@ -183,9 +183,8 @@ class ServerTagsController(wsgi.Controller):
try:
with nova_context.target_cell(context, im.cell_mapping):
objects.Tag.destroy(context, server_id, id)
except exception.InstanceTagNotFound as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceNotFound as e:
except (exception.InstanceTagNotFound,
exception.InstanceNotFound) as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message())
@wsgi.Controller.api_version("2.26")

View File

@@ -336,13 +336,11 @@ class VolumeAttachmentController(wsgi.Controller):
try:
device = self.compute_api.attach_volume(context, instance,
volume_id, device)
except exception.InstanceUnknownCell as e:
except (exception.InstanceUnknownCell,
exception.VolumeNotFound) as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.VolumeNotFound as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except exception.InstanceIsLocked as e:
raise exc.HTTPConflict(explanation=e.format_message())
except exception.DevicePathInUse as e:
except (exception.InstanceIsLocked,
exception.DevicePathInUse) as e:
raise exc.HTTPConflict(explanation=e.format_message())
except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error,