From: John Griffith Date: Tue, 15 Oct 2013 19:57:48 +0000 (-0600) Subject: FK lookup failures during migration X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=645a84f990c90e28548cf35b4b5f242eb0e0c286;p=openstack-build%2Fcinder-build.git FK lookup failures during migration There are a couple of cases where migrations have failed upgrading from Grizzly to Havana, this seems to be isolated to a couple of migrations so far and the error message is a failure to lookup/associate the volume-id FK dependency. It appears that this is caused by not setting the charset in the migration, so the result is that the initial db setup uses utf8 and the migrations are using the default latin1. This patch goes through all of the migrations in Havana that specify InnoDB and explicitly sets the charset to utf8 to match the volumes table (and the other original tables). Change-Id: I43b219ff5e4eea10a7391ad65ef68a80b7460370 Closes-Bug: #1233861 --- 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 781a44370..26b4bd6b2 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 @@ -40,7 +40,8 @@ def upgrade(migrate_engine): Column('salt', String(length=255)), Column('crypt_hash', String(length=255)), Column('expires_at', DateTime(timezone=False)), - mysql_engine='InnoDB' + mysql_engine='InnoDB', + mysql_charset='utf8' ) try: diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/015_drop_migrations_table.py b/cinder/db/sqlalchemy/migrate_repo/versions/015_drop_migrations_table.py index 2de50be94..75627b371 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/015_drop_migrations_table.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/015_drop_migrations_table.py @@ -53,7 +53,8 @@ def downgrade(migrate_engine): Column('new_instance_type_id', Integer), Column('instance_uuid', String(length=255), nullable=True), Column('status', String(length=255)), - mysql_engine='InnoDB' + mysql_engine='InnoDB', + mysql_charset='utf8' ) try: diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/016_drop_sm_tables.py b/cinder/db/sqlalchemy/migrate_repo/versions/016_drop_sm_tables.py index 0ad1fafc8..2dabaa51a 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/016_drop_sm_tables.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/016_drop_sm_tables.py @@ -59,7 +59,8 @@ def downgrade(migrate_engine): Column('sr_uuid', String(length=255)), Column('sr_type', String(length=255)), Column('config_params', String(length=2047)), - mysql_engine='InnoDB' + mysql_engine='InnoDB', + mysql_charset='utf8' ) sm_flavors = Table( @@ -71,7 +72,8 @@ def downgrade(migrate_engine): Column('id', Integer, primary_key=True, nullable=False), Column('label', String(length=255)), Column('description', String(length=255)), - mysql_engine='InnoDB' + mysql_engine='InnoDB', + mysql_charset='utf8' ) sm_volume = Table( @@ -87,7 +89,8 @@ def downgrade(migrate_engine): Column('backend_id', Integer, ForeignKey('sm_backend_config.id'), nullable=False), Column('vdi_uuid', String(length=255)), - mysql_engine='InnoDB' + mysql_engine='InnoDB', + mysql_charset='utf8' ) tables = [sm_flavors, sm_backend_config, sm_volume] diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py b/cinder/db/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py index 6b80969d1..df4347101 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py @@ -74,7 +74,8 @@ def upgrade(migrate_engine): Column('volume_type_id', String(length=36), ForeignKey(volume_types.c.id), primary_key=True, nullable=False), - mysql_engine='InnoDB' + mysql_engine='InnoDB', + mysql_charset='utf8' ) try: diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/018_add_qos_specs.py b/cinder/db/sqlalchemy/migrate_repo/versions/018_add_qos_specs.py index a67b58744..c5fbe73be 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/018_add_qos_specs.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/018_add_qos_specs.py @@ -40,7 +40,8 @@ def upgrade(migrate_engine): ForeignKey('quality_of_service_specs.id')), Column('key', String(255)), Column('value', String(255)), - mysql_engine='InnoDB' + mysql_engine='InnoDB', + mysql_charset='utf8' ) try: diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/020_add_volume_admin_metadata_table.py b/cinder/db/sqlalchemy/migrate_repo/versions/020_add_volume_admin_metadata_table.py index f59c5c88c..0cfe9ae42 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/020_add_volume_admin_metadata_table.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/020_add_volume_admin_metadata_table.py @@ -38,7 +38,8 @@ def upgrade(migrate_engine): nullable=False), Column('key', String(length=255)), Column('value', String(length=255)), - mysql_engine='InnoDB' + mysql_engine='InnoDB', + mysql_charset='utf8' ) try: