diff --git a/cinder/api/v1/snapshots.py b/cinder/api/v1/snapshots.py index 08d87afbf..1e4411143 100644 --- a/cinder/api/v1/snapshots.py +++ b/cinder/api/v1/snapshots.py @@ -173,7 +173,11 @@ class SnapshotsController(wsgi.Controller): msg = _("'volume_id' must be specified") raise exc.HTTPBadRequest(explanation=msg) - volume = self.volume_api.get(context, volume_id) + try: + volume = self.volume_api.get(context, volume_id) + except exception.NotFound: + raise exc.HTTPNotFound() + force = snapshot.get('force', False) msg = _("Create snapshot from volume %s") LOG.audit(msg, volume_id, context=context) diff --git a/cinder/api/v2/snapshots.py b/cinder/api/v2/snapshots.py index 24703317a..bc74d58fd 100644 --- a/cinder/api/v2/snapshots.py +++ b/cinder/api/v2/snapshots.py @@ -184,7 +184,11 @@ class SnapshotsController(wsgi.Controller): msg = _("'volume_id' must be specified") raise exc.HTTPBadRequest(explanation=msg) - volume = self.volume_api.get(context, volume_id) + try: + volume = self.volume_api.get(context, volume_id) + except exception.NotFound: + msg = _("Volume could not be found") + raise exc.HTTPNotFound(explanation=msg) force = snapshot.get('force', False) msg = _("Create snapshot from volume %s") LOG.audit(msg, volume_id, context=context)