Skip to content

Commit

Permalink
Present correct ec2id format for volumes and snaps
Browse files Browse the repository at this point in the history
Fixes bug 1013765
* Add template argument to ec2utils.id_to_ec2_id() calls

Change-Id: I5e574f8e60d091ef8862ad814e2c8ab993daa366
  • Loading branch information
j-griffith committed Jun 15, 2012
1 parent e4b4d34 commit 2020fba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nova/api/ec2/ec2utils.py
Expand Up @@ -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')

Expand All @@ -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')

Expand All @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit 2020fba

Please sign in to comment.