diff options
| author | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-10-04 16:39:05 -0400 |
|---|---|---|
| committer | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-10-04 16:39:05 -0400 |
| commit | dd0f365c98ae68afff9a0fbc75e7d5b88499b282 (patch) | |
| tree | ea9eac5f0f0f2061b9016c98d2d901b613d4407d /nova/utils.py | |
| parent | 2a8e4a3e818f1d279a886e2e5f5ae49f3de26a4d (diff) | |
| download | nova-dd0f365c98ae68afff9a0fbc75e7d5b88499b282.tar.gz nova-dd0f365c98ae68afff9a0fbc75e7d5b88499b282.tar.xz nova-dd0f365c98ae68afff9a0fbc75e7d5b88499b282.zip | |
Fix broken unit tests
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/nova/utils.py b/nova/utils.py index 5f64b13c4..b1699bda8 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -126,8 +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(): |
