diff options
author | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-10-12 22:43:37 +0000 |
---|---|---|
committer | Tarmac <> | 2010-10-12 22:43:37 +0000 |
commit | d0a55238fdf64a8da51ea1fe328a1a3dc3d17dc7 (patch) | |
tree | aca86d69fe0bce270c9e7b8e1dc6113db380544b | |
parent | 8896e712e90330ae42c13367fd79b1a18b56c0a0 (diff) | |
parent | aa92c017ab91d7fb0ec9c2cd5fd420e625ce2dbd (diff) | |
download | nova-d0a55238fdf64a8da51ea1fe328a1a3dc3d17dc7.tar.gz nova-d0a55238fdf64a8da51ea1fe328a1a3dc3d17dc7.tar.xz nova-d0a55238fdf64a8da51ea1fe328a1a3dc3d17dc7.zip |
Revert the conversion to 64-bit ints stored in a PickleType column, because PickleType is incompatible with having a unique constraint.
We moved away from 32 bit ints because of the chance of collision. It turns out the existing code already checked for collisions and retried, so this wasn't an issue.
-rw-r--r-- | nova/db/sqlalchemy/models.py | 4 | ||||
-rw-r--r-- | nova/utils.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index 7dfc39f6f..0eb9a8f18 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, PickleType, Integer, String +from sqlalchemy import Column, 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(PickleType(mutable=False), unique=True) + internal_id = Column(Integer, unique=True) admin_pass = Column(String(255)) diff --git a/nova/utils.py b/nova/utils.py index 12afd388f..10b27ffec 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -128,7 +128,7 @@ def runthis(prompt, cmd, check_exit_code = True): def generate_uid(topic, size=8): if topic == "i": # Instances have integer internal ids. - return random.randint(0, 2**64-1) + return random.randint(0, 2**32-1) else: characters = '01234567890abcdefghijklmnopqrstuvwxyz' choices = [random.choice(characters) for x in xrange(size)] |