diff options
| author | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-10-12 15:02:24 -0400 |
|---|---|---|
| committer | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-10-12 15:02:24 -0400 |
| commit | f97ef73699e060a21ef8e64966f2429ff3dec237 (patch) | |
| tree | 176eb5146615bd45dfe731e350082f319add8770 | |
| parent | 32ea289d13a7ec9d273a57d2bf30484b80bfebec (diff) | |
| parent | eeb1ac483adc21616668504772620e885944b2d7 (diff) | |
| download | nova-f97ef73699e060a21ef8e64966f2429ff3dec237.tar.gz nova-f97ef73699e060a21ef8e64966f2429ff3dec237.tar.xz nova-f97ef73699e060a21ef8e64966f2429ff3dec237.zip | |
32 bit internal_ids become 64 bit. Since there is no 64 bit native type in SqlAlchemy, we use PickleType which uses the Binary SqlAlchemy type under the hood.
| -rw-r--r-- | nova/db/sqlalchemy/models.py | 4 | ||||
| -rw-r--r-- | nova/utils.py | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index fc99a535d..9809eb7a7 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -25,7 +25,7 @@ import datetime # TODO(vish): clean up these imports from sqlalchemy.orm import relationship, backref, exc, object_mapper -from sqlalchemy import Column, Integer, String +from sqlalchemy import Column, PickleType, Integer, String from sqlalchemy import ForeignKey, DateTime, Boolean, Text from sqlalchemy.exc import IntegrityError from sqlalchemy.ext.declarative import declarative_base @@ -152,7 +152,7 @@ class Instance(BASE, NovaBase): __tablename__ = 'instances' __prefix__ = 'i' id = Column(Integer, primary_key=True) - internal_id = Column(Integer, unique=True) + internal_id = Column(PickleType(mutable=False), unique=True) admin_pass = Column(String(255)) 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)] |
