diff options
| author | Sirisha Devineni <sirisha_devineni@persistent.co.in> | 2012-09-13 23:44:08 +0530 |
|---|---|---|
| committer | Sirisha Devineni <sirisha_devineni@persistent.co.in> | 2012-09-20 15:28:18 +0530 |
| commit | a7a0705699662ec3a604126eec868c673cd5328e (patch) | |
| tree | 999edaf31f5a72298c2dc7e5ac6538c7833ffb0e /nova/api | |
| parent | 64a45f03c180a485f72be54a1b42f23b7a752699 (diff) | |
| download | nova-a7a0705699662ec3a604126eec868c673cd5328e.tar.gz nova-a7a0705699662ec3a604126eec868c673cd5328e.tar.xz nova-a7a0705699662ec3a604126eec868c673cd5328e.zip | |
Raise NotFound for non-existent volume snapshot create
When user tries to create snapshot of a non-existent volume then
handle the VolumeNotFound exception raised during snapshot creation
and throw it as HTTPNotFound
Fixes bug 1050388
Change-Id: I869ed6a29f66889636bcf92115117d407079e539
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/volume/snapshots.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nova/api/openstack/volume/snapshots.py b/nova/api/openstack/volume/snapshots.py index bba3b0ced..74c5f75e6 100644 --- a/nova/api/openstack/volume/snapshots.py +++ b/nova/api/openstack/volume/snapshots.py @@ -151,7 +151,12 @@ class SnapshotsController(wsgi.Controller): snapshot = body['snapshot'] volume_id = snapshot['volume_id'] - volume = self.volume_api.get(context, volume_id) + + try: + volume = self.volume_api.get(context, volume_id) + except exception.VolumeNotFound as err: + raise exc.HTTPNotFound(explanation=unicode(err)) + force = snapshot.get('force', False) msg = _("Create snapshot from volume %s") LOG.audit(msg, volume_id, context=context) |
