summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@yahoo.com>2010-10-12 19:00:34 -0700
committerVishvananda Ishaya <vishvananda@yahoo.com>2010-10-12 19:00:34 -0700
commitdbbdebbcd13b08ec2afb6d0d58144eeee6ecce84 (patch)
tree2e458dec12a89fcf5497367486f4288f87a06883 /nova/utils.py
parent6cc81214b58972c0d0e815ad340c32862be834dc (diff)
parentd0a55238fdf64a8da51ea1fe328a1a3dc3d17dc7 (diff)
downloadnova-dbbdebbcd13b08ec2afb6d0d58144eeee6ecce84.tar.gz
nova-dbbdebbcd13b08ec2afb6d0d58144eeee6ecce84.tar.xz
nova-dbbdebbcd13b08ec2afb6d0d58144eeee6ecce84.zip
merged trunk
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/nova/utils.py b/nova/utils.py
index d18dd9843..10b27ffec 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -126,7 +126,13 @@ def runthis(prompt, cmd, check_exit_code = True):
def generate_uid(topic, size=8):
- return '%s-%s' % (topic, ''.join([random.choice('01234567890abcdefghijklmnopqrstuvwxyz') for x in xrange(size)]))
+ if topic == "i":
+ # Instances have integer internal ids.
+ return random.randint(0, 2**32-1)
+ else:
+ characters = '01234567890abcdefghijklmnopqrstuvwxyz'
+ choices = [random.choice(characters) for x in xrange(size)]
+ return '%s-%s' % (topic, ''.join(choices))
def generate_mac():