summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-02-08 18:55:52 +0000
committerGerrit Code Review <review@openstack.org>2012-02-08 18:55:52 +0000
commit85f4255cdd853adb46545e3215c224c4b9906826 (patch)
treebcc3c439860b69312631fd7f8dae472154b720b2 /nova/api
parent2b1c523026ea07e4fa4e7ff42e345b9dcbca23f6 (diff)
parenta3596658c83ed84970cfaba40d7f489728a00d48 (diff)
downloadnova-85f4255cdd853adb46545e3215c224c4b9906826.tar.gz
nova-85f4255cdd853adb46545e3215c224c4b9906826.tar.xz
nova-85f4255cdd853adb46545e3215c224c4b9906826.zip
Merge "Fixes volume snapshotting issues and tests"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/volumes.py6
-rw-r--r--nova/api/openstack/volume/snapshots.py4
2 files changed, 6 insertions, 4 deletions
diff --git a/nova/api/openstack/compute/contrib/volumes.py b/nova/api/openstack/compute/contrib/volumes.py
index 6d0110069..e235ad0fe 100644
--- a/nova/api/openstack/compute/contrib/volumes.py
+++ b/nova/api/openstack/compute/contrib/volumes.py
@@ -517,18 +517,20 @@ class SnapshotController(object):
snapshot = body['snapshot']
volume_id = snapshot['volume_id']
+ volume = self.volume_api.get(context, volume_id)
+
force = snapshot.get('force', False)
LOG.audit(_("Create snapshot from volume %s"), volume_id,
context=context)
if force:
new_snapshot = self.volume_api.create_snapshot_force(context,
- volume_id,
+ volume,
snapshot.get('display_name'),
snapshot.get('display_description'))
else:
new_snapshot = self.volume_api.create_snapshot(context,
- volume_id,
+ volume,
snapshot.get('display_name'),
snapshot.get('display_description'))
diff --git a/nova/api/openstack/volume/snapshots.py b/nova/api/openstack/volume/snapshots.py
index 36687d736..67cfca3ea 100644
--- a/nova/api/openstack/volume/snapshots.py
+++ b/nova/api/openstack/volume/snapshots.py
@@ -98,7 +98,7 @@ class SnapshotsController(object):
try:
vol = self.volume_api.get_snapshot(context, id)
except exception.NotFound:
- return exc.HTTPNotFound()
+ raise exc.HTTPNotFound()
return {'snapshot': _translate_snapshot_detail_view(context, vol)}
@@ -112,7 +112,7 @@ class SnapshotsController(object):
snapshot = self.volume_api.get_snapshot(context, id)
self.volume_api.delete_snapshot(context, snapshot)
except exception.NotFound:
- return exc.HTTPNotFound()
+ raise exc.HTTPNotFound()
return webob.Response(status_int=202)
@wsgi.serializers(xml=SnapshotsTemplate)