summaryrefslogtreecommitdiff
path: root/nova/api/ec2
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2014-08-11 22:01:51 +0000
committerRussell Bryant <rbryant@redhat.com>2014-08-14 15:58:38 +0000
commitfa98ec7b42826120870ec059860a19217beff3b3 (patch)
tree624ddfa59dfaa9ab8e0438081c8060493e7b8e48 /nova/api/ec2
parent6db7eb7d838b00c20540e062ecf7be7b2ae831a2 (diff)
downloadnova-fa98ec7b42826120870ec059860a19217beff3b3.tar.gz
Get EC2 snapshot mappings with nova object
Use the EC2SnapshotMapping nova object for getting the mapping instead of directly using the db API. Part of blueprint convert-ec2-api-to-use-objects Change-Id: I258ffe0a3fe3b0d7b2524bb64f1137127731bdd5
Diffstat (limited to 'nova/api/ec2')
-rw-r--r--nova/api/ec2/ec2utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/nova/api/ec2/ec2utils.py b/nova/api/ec2/ec2utils.py
index ea011ee4aa..80ea9c7994 100644
--- a/nova/api/ec2/ec2utils.py
+++ b/nova/api/ec2/ec2utils.py
@@ -344,7 +344,8 @@ def get_int_id_from_snapshot_uuid(context, snapshot_uuid):
if snapshot_uuid is None:
return
try:
- return db.get_ec2_snapshot_id_by_uuid(context, snapshot_uuid)
+ smap = objects.EC2SnapshotMapping.get_by_uuid(context, snapshot_uuid)
+ return smap.id
except exception.NotFound:
smap = objects.EC2SnapshotMapping(context, uuid=snapshot_uuid)
smap.create()
@@ -353,7 +354,8 @@ def get_int_id_from_snapshot_uuid(context, snapshot_uuid):
@memoize
def get_snapshot_uuid_from_int_id(context, int_id):
- return db.get_snapshot_uuid_by_ec2_id(context, int_id)
+ smap = objects.EC2SnapshotMapping.get_by_id(context, int_id)
+ return smap.uuid
_c2u = re.compile('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))')