summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorSoren Hansen <soren.hansen@rackspace.com>2010-10-08 21:41:11 +0200
committerSoren Hansen <soren.hansen@rackspace.com>2010-10-08 21:41:11 +0200
commit5be81520196c21aa9b60425bca7bf49935772cd1 (patch)
treeb2abb4d185d9c0ebfbb145f92fddc2bb201f3361 /nova/utils.py
parent5a5da05a966dcdd3113a074468b37e12d406b350 (diff)
parentd58da66e2958ff3bb32c8f764c90526be5c601af (diff)
downloadnova-5be81520196c21aa9b60425bca7bf49935772cd1.tar.gz
nova-5be81520196c21aa9b60425bca7bf49935772cd1.tar.xz
nova-5be81520196c21aa9b60425bca7bf49935772cd1.zip
Merge trunk.
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/nova/utils.py b/nova/utils.py
index d18dd9843..b1699bda8 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -126,7 +126,15 @@ 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.
+ #TODO(gundlach): We should make this more than 32 bits, but we need to
+ #figure out how to make the DB happy with 64 bit integers.
+ 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():