diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-05-15 19:50:20 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-05-15 19:50:20 +0000 |
| commit | ae624fe2e75cfc61826b160e68823bc41d062518 (patch) | |
| tree | 734abc38f0a022160fe3101a094504c8093d2f1e /nova/api | |
| parent | 1a71dfcd274fb623694203bfe6a2db8b7355bb74 (diff) | |
| parent | 586e752e69ca891714f390bf59ad30d5081d4498 (diff) | |
| download | nova-ae624fe2e75cfc61826b160e68823bc41d062518.tar.gz nova-ae624fe2e75cfc61826b160e68823bc41d062518.tar.xz nova-ae624fe2e75cfc61826b160e68823bc41d062518.zip | |
Merge "Refactor nova.volume.cinder.API to reduce roundtrips with Cinder"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 10 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/volumes.py | 11 |
2 files changed, 8 insertions, 13 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index e2abde48c..181dfb0c2 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -391,8 +391,8 @@ class CloudController(object): LOG.audit(_("Create snapshot of volume %s"), volume_id, context=context) volume_id = ec2utils.ec2_vol_id_to_uuid(volume_id) - volume = self.volume_api.get(context, volume_id) - args = (context, volume, kwargs.get('name'), kwargs.get('description')) + args = (context, volume_id, kwargs.get('name'), + kwargs.get('description')) if kwargs.get('force', False): snapshot = self.volume_api.create_snapshot_force(*args) else: @@ -403,8 +403,7 @@ class CloudController(object): def delete_snapshot(self, context, snapshot_id, **kwargs): snapshot_id = ec2utils.ec2_snap_id_to_uuid(snapshot_id) - snapshot = self.volume_api.get_snapshot(context, snapshot_id) - self.volume_api.delete_snapshot(context, snapshot) + self.volume_api.delete_snapshot(context, snapshot_id) return True def describe_key_pairs(self, context, key_name=None, **kwargs): @@ -860,8 +859,7 @@ class CloudController(object): validate_ec2_id(volume_id) volume_id = ec2utils.ec2_vol_id_to_uuid(volume_id) try: - volume = self.volume_api.get(context, volume_id) - self.volume_api.delete(context, volume) + self.volume_api.delete(context, volume_id) except exception.InvalidVolume: raise exception.EC2APIError(_('Delete Failed')) diff --git a/nova/api/openstack/compute/contrib/volumes.py b/nova/api/openstack/compute/contrib/volumes.py index ea1fb1f21..e49c65b2f 100644 --- a/nova/api/openstack/compute/contrib/volumes.py +++ b/nova/api/openstack/compute/contrib/volumes.py @@ -188,8 +188,7 @@ class VolumeController(wsgi.Controller): LOG.audit(_("Delete volume with id: %s"), id, context=context) try: - vol = self.volume_api.get(context, id) - self.volume_api.delete(context, vol) + self.volume_api.delete(context, id) except exception.NotFound: raise exc.HTTPNotFound() return webob.Response(status_int=202) @@ -578,8 +577,7 @@ class SnapshotController(wsgi.Controller): LOG.audit(_("Delete snapshot with id: %s"), id, context=context) try: - snapshot = self.volume_api.get_snapshot(context, id) - self.volume_api.delete_snapshot(context, snapshot) + self.volume_api.delete_snapshot(context, id) except exception.NotFound: return exc.HTTPNotFound() return webob.Response(status_int=202) @@ -615,7 +613,6 @@ class SnapshotController(wsgi.Controller): snapshot = body['snapshot'] volume_id = snapshot['volume_id'] - vol = self.volume_api.get(context, volume_id) force = snapshot.get('force', False) LOG.audit(_("Create snapshot from volume %s"), volume_id, @@ -627,12 +624,12 @@ class SnapshotController(wsgi.Controller): if strutils.bool_from_string(force): new_snapshot = self.volume_api.create_snapshot_force(context, - vol, + volume_id, snapshot.get('display_name'), snapshot.get('display_description')) else: new_snapshot = self.volume_api.create_snapshot(context, - vol, + volume_id, snapshot.get('display_name'), snapshot.get('display_description')) |
