From f2dbeafb4746c89734d70e15601f24aeb22b0d8f Mon Sep 17 00:00:00 2001 From: David Ripton Date: Tue, 9 Jul 2013 13:32:08 -0400 Subject: [PATCH] Make String column creation compatible with SQLAlchemy 0.8 3 migration scripts used the convert_unicode, unicode_error, and _warn_on_bytestring arguments when creating String columns. These seem to cause problems with SQLAlchemy 0.8. Nova excised all use of such arguments in commit 93dec58156e when squashing migrations for Grizzly, and seems to have no problems with SQLAlchemy 0.8. Fixes bug 1199453 Change-Id: Ie4b46339423e6a1ad3d8ca699a2412b825206c0e --- .../migrate_repo/versions/002_quota_class.py | 31 +++---------- .../migrate_repo/versions/008_add_backup.py | 46 +++++-------------- .../versions/010_add_transfers_table.py | 15 ++---- 3 files changed, 21 insertions(+), 71 deletions(-) diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/002_quota_class.py b/cinder/db/sqlalchemy/migrate_repo/versions/002_quota_class.py index fe911c0d4..736c03cb3 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/002_quota_class.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/002_quota_class.py @@ -35,16 +35,10 @@ def upgrade(migrate_engine): name=None)), Column('id', Integer(), primary_key=True), Column('class_name', - String(length=255, - convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False), + String(length=255), index=True), Column('resource', - String(length=255, - convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False)), + String(length=255)), Column('hard_limit', Integer(), nullable=True), mysql_engine='InnoDB', mysql_charset='utf8', @@ -64,14 +58,10 @@ def upgrade(migrate_engine): name=None)), Column('id', Integer(), primary_key=True), Column('project_id', - String(length=255, convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False), + String(length=255), index=True), Column('resource', - String(length=255, convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False)), + String(length=255)), Column('in_use', Integer(), nullable=False), Column('reserved', Integer(), nullable=False), Column('until_refresh', Integer(), nullable=True), @@ -93,24 +83,17 @@ def upgrade(migrate_engine): name=None)), Column('id', Integer(), primary_key=True), Column('uuid', - String(length=36, - convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False), + String(length=36), nullable=False), Column('usage_id', Integer(), ForeignKey('quota_usages.id'), nullable=False), Column('project_id', - String(length=255, convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False), + String(length=255), index=True), Column('resource', - String(length=255, convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False)), + String(length=255)), Column('delta', Integer(), nullable=False), Column('expire', DateTime(timezone=False)), mysql_engine='InnoDB', diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/008_add_backup.py b/cinder/db/sqlalchemy/migrate_repo/versions/008_add_backup.py index 5dfbed0f6..f23f4e07e 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/008_add_backup.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/008_add_backup.py @@ -36,41 +36,17 @@ def upgrade(migrate_engine): Column('deleted', Boolean(create_constraint=True, name=None)), Column('id', String(36), primary_key=True, nullable=False), Column('volume_id', String(36), nullable=False), - Column('user_id', String(length=255, convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('project_id', String(length=255, convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('host', String(length=255, convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('availability_zone', String(length=255, - convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('display_name', String(length=255, convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('display_description', String(length=255, - convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('container', String(length=255, convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('status', String(length=255, convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('fail_reason', String(length=255, convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('service_metadata', String(length=255, convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), - Column('service', String(length=255, convert_unicode=False, - unicode_error=None, - _warn_on_bytestring=False)), + Column('user_id', String(length=255)), + Column('project_id', String(length=255)), + Column('host', String(length=255)), + Column('availability_zone', String(length=255)), + Column('display_name', String(length=255)), + Column('display_description', String(length=255)), + Column('container', String(length=255)), + Column('status', String(length=255)), + Column('fail_reason', String(length=255)), + Column('service_metadata', String(length=255)), + Column('service', String(length=255)), Column('size', Integer()), Column('object_count', Integer()), mysql_engine='InnoDB' diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/010_add_transfers_table.py b/cinder/db/sqlalchemy/migrate_repo/versions/010_add_transfers_table.py index 3eae5df52..781a44370 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/010_add_transfers_table.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/010_add_transfers_table.py @@ -36,18 +36,9 @@ def upgrade(migrate_engine): Column('id', String(36), primary_key=True, nullable=False), Column('volume_id', String(length=36), ForeignKey('volumes.id'), nullable=False), - Column('display_name', String(length=255, - convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False)), - Column('salt', String(length=255, - convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False)), - Column('crypt_hash', String(length=255, - convert_unicode=True, - unicode_error=None, - _warn_on_bytestring=False)), + Column('display_name', String(length=255)), + Column('salt', String(length=255)), + Column('crypt_hash', String(length=255)), Column('expires_at', DateTime(timezone=False)), mysql_engine='InnoDB' ) -- 2.45.2