diff options
| author | Eric Day <eday@oddments.org> | 2011-01-04 09:44:15 -0800 |
|---|---|---|
| committer | Eric Day <eday@oddments.org> | 2011-01-04 09:44:15 -0800 |
| commit | 8bbcadafbc25c7ab478d6143293232f2cea24411 (patch) | |
| tree | df217cadd11ede398aa0c46513fb59b49ae5e8ca /nova/api | |
| parent | f40baf7d966dc2f72484411c518e503866521b96 (diff) | |
| download | nova-8bbcadafbc25c7ab478d6143293232f2cea24411.tar.gz nova-8bbcadafbc25c7ab478d6143293232f2cea24411.tar.xz nova-8bbcadafbc25c7ab478d6143293232f2cea24411.zip | |
Removed UUID keys for instance and volume.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index a6818855d..b1eaafc8b 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -72,13 +72,17 @@ def _gen_key(context, user_id, key_name): def ec2_id_to_id(ec2_id): - """Convert an ec2 ID and an instance ID.""" - return ec2_id[2:] + """Convert an ec2 ID (i-[base 36 number]) to an instance id (int)""" + return int(ec2_id[2:], 36) def id_to_ec2_id(instance_id): - """Convert an instance ID to an ec2 ID.""" - return "i-%s" % instance_id + """Convert an instance ID (int) to an ec2 ID (i-[base 36 number])""" + digits = [] + while instance_id != 0: + instance_id, remainder = divmod(instance_id, 36) + digits.append('0123456789abcdefghijklmnopqrstuvwxyz'[remainder]) + return "i-%s" % ''.join(reversed(digits)) class CloudController(object): |
