diff options
author | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-10-12 20:08:39 +0000 |
---|---|---|
committer | Tarmac <> | 2010-10-12 20:08:39 +0000 |
commit | 4f529fe118283164ccb2756f2001805c69c1cc4a (patch) | |
tree | 176eb5146615bd45dfe731e350082f319add8770 /nova/utils.py | |
parent | eeb1ac483adc21616668504772620e885944b2d7 (diff) | |
parent | f97ef73699e060a21ef8e64966f2429ff3dec237 (diff) | |
download | nova-4f529fe118283164ccb2756f2001805c69c1cc4a.tar.gz nova-4f529fe118283164ccb2756f2001805c69c1cc4a.tar.xz nova-4f529fe118283164ccb2756f2001805c69c1cc4a.zip |
Change internal_id from a 32 bit int to a 64 bit int.
Specifically, generate internal_id as a random number in [0, 2^64). SQLAlchemy has no built-in type for big integers, so the internal_id column is a PickleType, set to non-mutable to avoid performance penalties associated with mutable column types. Under the hood, this is stored as a Binary.
In Austin+1 we'll probably be replacing internal_id with a string, but we need something bigger than 32 bits for Austin.
Diffstat (limited to 'nova/utils.py')
-rw-r--r-- | nova/utils.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/nova/utils.py b/nova/utils.py index b1699bda8..12afd388f 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -128,9 +128,7 @@ def runthis(prompt, cmd, check_exit_code = True): def generate_uid(topic, size=8): 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) + return random.randint(0, 2**64-1) else: characters = '01234567890abcdefghijklmnopqrstuvwxyz' choices = [random.choice(characters) for x in xrange(size)] |