From 2020fba6731634319a0d541168fbf45138825357 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Fri, 15 Jun 2012 11:12:45 -0600 Subject: Present correct ec2id format for volumes and snaps Fixes bug 1013765 * Add template argument to ec2utils.id_to_ec2_id() calls Change-Id: I5e574f8e60d091ef8862ad814e2c8ab993daa366 --- nova/api/ec2/ec2utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nova/api/ec2/ec2utils.py b/nova/api/ec2/ec2utils.py index ceb695a5e..fff7616c9 100644 --- a/nova/api/ec2/ec2utils.py +++ b/nova/api/ec2/ec2utils.py @@ -138,7 +138,7 @@ def id_to_ec2_snap_id(snapshot_id): if utils.is_uuid_like(snapshot_id): ctxt = context.get_admin_context() int_id = get_int_id_from_snapshot_uuid(ctxt, snapshot_id) - return id_to_ec2_id(int_id) + return id_to_ec2_id(int_id, 'snap-%08x') else: return id_to_ec2_id(snapshot_id, 'snap-%08x') @@ -148,7 +148,7 @@ def id_to_ec2_vol_id(volume_id): if utils.is_uuid_like(volume_id): ctxt = context.get_admin_context() int_id = get_int_id_from_volume_uuid(ctxt, volume_id) - return id_to_ec2_id(int_id) + return id_to_ec2_id(int_id, 'vol-%08x') else: return id_to_ec2_id(volume_id, 'vol-%08x') @@ -168,7 +168,7 @@ def get_int_id_from_volume_uuid(context, volume_uuid): try: return db.get_ec2_volume_id_by_uuid(context, volume_uuid) except exception.NotFound: - raise exception.VolumeNotFound() + return db.ec2_volume_create(context, volume_uuid)['id'] def get_volume_uuid_from_int_id(context, int_id): @@ -190,7 +190,7 @@ def get_int_id_from_snapshot_uuid(context, snapshot_uuid): try: return db.get_ec2_snapshot_id_by_uuid(context, snapshot_uuid) except exception.NotFound: - raise exception.SnapshotNotFound() + return db.ec2_snapshot_create(context, snapshot_uuid)['id'] def get_snapshot_uuid_from_int_id(context, int_id): -- cgit