Merge "Present correct ec2id format for volumes and snaps"

This commit is contained in:
Jenkins 2012-06-15 23:03:14 +00:00 committed by Gerrit Code Review
commit fb9abcc839

View File

@ -145,7 +145,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')
@ -155,7 +155,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')
@ -175,7 +175,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):
@ -197,7 +197,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):