diff --git a/nova/db/sqlalchemy/migrate_repo/versions/391_add_volume_type_to_bdm.py b/nova/db/sqlalchemy/migrate_repo/versions/391_add_volume_type_to_bdm.py deleted file mode 100644 index ac9132888313..000000000000 --- a/nova/db/sqlalchemy/migrate_repo/versions/391_add_volume_type_to_bdm.py +++ /dev/null @@ -1,32 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -from sqlalchemy import Column -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -BASE_TABLE_NAME = 'block_device_mapping' -NEW_COLUMN_NAME = 'volume_type' - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - for prefix in ('', 'shadow_'): - table = Table(prefix + BASE_TABLE_NAME, meta, autoload=True) - new_column = Column(NEW_COLUMN_NAME, String(255), nullable=True) - if not hasattr(table.c, NEW_COLUMN_NAME): - table.create_column(new_column) diff --git a/nova/db/sqlalchemy/migrate_repo/versions/390_rocky.py b/nova/db/sqlalchemy/migrate_repo/versions/391_stein.py similarity index 99% rename from nova/db/sqlalchemy/migrate_repo/versions/390_rocky.py rename to nova/db/sqlalchemy/migrate_repo/versions/391_stein.py index 859cec0ca0ab..a90cc08693dd 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/390_rocky.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/391_stein.py @@ -236,6 +236,7 @@ def upgrade(migrate_engine): Column('tag', String(255)), Column('attachment_id', String(36), nullable=True), Column('uuid', String(36), nullable=True), + Column('volume_type', String(255), nullable=True), UniqueConstraint('uuid', name='uniq_block_device_mapping0uuid'), mysql_engine='InnoDB', mysql_charset='utf8' diff --git a/nova/db/sqlalchemy/migration.py b/nova/db/sqlalchemy/migration.py index 65cc52fa44e2..21a065193b60 100644 --- a/nova/db/sqlalchemy/migration.py +++ b/nova/db/sqlalchemy/migration.py @@ -29,7 +29,7 @@ from nova import exception from nova.i18n import _ INIT_VERSION = {} -INIT_VERSION['main'] = 389 +INIT_VERSION['main'] = 390 INIT_VERSION['api'] = 0 _REPOSITORY = {} diff --git a/nova/tests/unit/db/test_migrations.py b/nova/tests/unit/db/test_migrations.py index 2ce04878608d..83c9e885d969 100644 --- a/nova/tests/unit/db/test_migrations.py +++ b/nova/tests/unit/db/test_migrations.py @@ -162,9 +162,6 @@ class NovaMigrationsCheckers(test_migrations.ModelsMigrationsSync, self.INIT_VERSION + 1, ] - # We forgot to add the rocky placeholder. We've also switched to 5 - # placeholders per cycle since the rate of DB changes has dropped - # significantly stein_placeholders = list(range(392, 397)) train_placeholders = list(range(403, 408)) ussuri_placeholders = list(range(408, 413)) @@ -229,11 +226,6 @@ class NovaMigrationsCheckers(test_migrations.ModelsMigrationsSync, def test_walk_versions(self): self.walk_versions(snake_walk=False, downgrade=False) - def _check_391(self, engine, data): - self.assertColumnExists(engine, 'block_device_mapping', 'volume_type') - self.assertColumnExists(engine, 'shadow_block_device_mapping', - 'volume_type') - def _check_397(self, engine, data): for prefix in ('', 'shadow_'): self.assertColumnExists(