diff --git a/nova/api/openstack/compute/deferred_delete.py b/nova/api/openstack/compute/deferred_delete.py index e8743fc625..c47838b030 100644 --- a/nova/api/openstack/compute/deferred_delete.py +++ b/nova/api/openstack/compute/deferred_delete.py @@ -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()) diff --git a/nova/api/openstack/compute/server_tags.py b/nova/api/openstack/compute/server_tags.py index f2572ac02a..3eb0b401e1 100644 --- a/nova/api/openstack/compute/server_tags.py +++ b/nova/api/openstack/compute/server_tags.py @@ -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") diff --git a/nova/api/openstack/compute/volumes.py b/nova/api/openstack/compute/volumes.py index e5ea504220..ca16b3750f 100644 --- a/nova/api/openstack/compute/volumes.py +++ b/nova/api/openstack/compute/volumes.py @@ -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,