From 47c0d2ebd55d4c5de2c3e914a7c3f91a8d31a20d Mon Sep 17 00:00:00 2001 From: Oleg Bondarev Date: Wed, 7 Aug 2013 16:15:51 +0400 Subject: [PATCH] Add support for service plugins to the migration framework Implements blueprint migrations-for-service-plugins Fixes bug 1209151 Change-Id: If7fc7a4488352e9b65b6973d8ea631e0d9ed8b68 --- neutron/db/migration/__init__.py | 4 +-- .../db/migration/alembic_migrations/env.py | 6 ++-- .../alembic_migrations/script.py.mako | 8 ++--- .../versions/1149d7de0cfa_port_security.py | 8 ++--- .../11c6e18605c8_pool_monitor_status_.py | 16 ++++----- .../versions/128e042a2b68_ext_gw_mode.py | 8 ++--- .../1341ed32cc1e_nvp_netbinding_update.py | 8 ++--- .../versions/13de305df56e_add_nec_pf_name.py | 8 ++--- .../176a85fc7d79_add_portbindings_db.py | 8 ++--- .../1b693c095aa3_quota_ext_db_grizzly.py | 8 ++--- .../1c33fa3cd1a1_extra_route_config.py | 8 ++--- .../versions/1d76643bcec4_nvp_netbinding.py | 8 ++--- .../2032abe8edac_lbaas_add_status_des.py | 12 ++++--- .../20ae61555e95_ml2_gre_type_driver.py | 8 ++--- .../263772d65691_cisco_db_cleanup_2.py | 8 ++--- .../2a6d0b51f4bb_cisco_plugin_cleanup.py | 8 ++--- .../versions/2c4af419145b_l3_support.py | 8 ++--- .../32b517556ec9_remove_tunnelip_mode.py | 8 ++--- ...35c7c198ddea_lbaas_healthmon_del_status.py | 12 ++++--- .../versions/363468ac592c_nvp_network_gw.py | 8 ++--- .../versions/38335592a0dc_nvp_portmap.py | 8 ++--- .../39cf3f799352_fwaas_havana_2_model.py | 12 ++++--- .../3b54bf9e29f7_nec_plugin_sharednet.py | 8 ++--- .../3cabb850f4a5_table_to_track_port_.py | 8 ++--- .../versions/3cb5d900c5de_security_groups.py | 8 ++--- .../versions/3cbf70257c28_nvp_mac_learning.py | 8 ++--- .../versions/45680af419f9_nvp_qos.py | 8 ++--- .../versions/4692d074d587_agent_scheduler.py | 8 ++--- .../477a4488d3f4_ml2_vxlan_type_driver.py | 8 ++--- .../versions/48b6f43f7471_service_type.py | 8 ++--- .../49332180ca96_ryu_plugin_update.py | 8 ++--- .../511471cc46b_agent_ext_model_supp.py | 9 ++--- .../52c5e4a18807_lbaas_pool_scheduler.py | 14 ++++++-- .../52ff27f7567a_support_for_vpnaas.py | 10 +++--- .../versions/54c2c487e913_lbaas.py | 8 ++--- .../557edfc53098_new_service_types.py | 12 ++++--- .../5918cbddab04_add_tables_for_route.py | 8 ++--- .../versions/5a875d0e5c_ryu.py | 8 ++--- .../versions/5ac71e65402c_ml2_initial.py | 8 ++--- .../b7a8863760e_rm_cisco_vlan_bindin.py | 8 ++--- .../e6b16a30d97_cisco_provider_nets.py | 8 ++--- .../versions/f489cf14a79c_lbaas_havana.py | 12 ++++--- .../versions/folsom_initial.py | 36 +++++++++---------- .../versions/grizzly_release.py | 4 +-- neutron/db/migration/cli.py | 3 ++ neutron/tests/unit/test_db_migration.py | 6 ++-- 46 files changed, 220 insertions(+), 196 deletions(-) diff --git a/neutron/db/migration/__init__.py b/neutron/db/migration/__init__.py index ec8012693a..2b102287eb 100644 --- a/neutron/db/migration/__init__.py +++ b/neutron/db/migration/__init__.py @@ -17,8 +17,8 @@ # @author: Mark McClain, DreamHost -def should_run(active_plugin, migrate_plugins): +def should_run(active_plugins, migrate_plugins): if '*' in migrate_plugins: return True else: - return active_plugin in migrate_plugins + return set(active_plugins) & set(migrate_plugins) diff --git a/neutron/db/migration/alembic_migrations/env.py b/neutron/db/migration/alembic_migrations/env.py index 300f05a075..f3f315bfef 100644 --- a/neutron/db/migration/alembic_migrations/env.py +++ b/neutron/db/migration/alembic_migrations/env.py @@ -37,6 +37,8 @@ neutron_config = config.neutron_config fileConfig(config.config_file_name) plugin_class_path = neutron_config.core_plugin +active_plugins = [plugin_class_path] +active_plugins += neutron_config.service_plugins plugin_klass = importutils.import_class(plugin_class_path) @@ -59,7 +61,7 @@ def run_migrations_offline(): context.configure(url=neutron_config.database.connection) with context.begin_transaction(): - context.run_migrations(active_plugin=plugin_class_path, + context.run_migrations(active_plugins=active_plugins, options=build_options()) @@ -82,7 +84,7 @@ def run_migrations_online(): try: with context.begin_transaction(): - context.run_migrations(active_plugin=plugin_class_path, + context.run_migrations(active_plugins=active_plugins, options=build_options()) finally: connection.close() diff --git a/neutron/db/migration/alembic_migrations/script.py.mako b/neutron/db/migration/alembic_migrations/script.py.mako index b730f72e43..9912615b7f 100644 --- a/neutron/db/migration/alembic_migrations/script.py.mako +++ b/neutron/db/migration/alembic_migrations/script.py.mako @@ -40,15 +40,15 @@ ${imports if imports else ""} from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ${upgrades if upgrades else "pass"} -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ${downgrades if downgrades else "pass"} diff --git a/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py b/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py index 575c12cff9..2de10aedfa 100644 --- a/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py +++ b/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py @@ -39,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### @@ -71,8 +71,8 @@ def upgrade(active_plugin=None, options=None): "False as port_security_enabled from ports") -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### diff --git a/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py b/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py index 8423e9efcf..a31bf6a951 100644 --- a/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py +++ b/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py @@ -29,7 +29,9 @@ down_revision = '52ff27f7567a' # Change to ['*'] if this migration applies to all plugins -migration_for_plugins = ['*'] +migration_for_plugins = [ + 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin', +] from alembic import op import sqlalchemy as sa @@ -37,12 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -# Change to ['*'] if this migration applies to all plugins -migration_for_plugins = ['*'] - - -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.add_column('poolmonitorassociations', sa.Column('status', @@ -55,8 +53,8 @@ def upgrade(active_plugin=None, options=None): op.execute("UPDATE poolmonitorassociations SET status='ACTIVE'") -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_column('poolmonitorassociations', 'status') diff --git a/neutron/db/migration/alembic_migrations/versions/128e042a2b68_ext_gw_mode.py b/neutron/db/migration/alembic_migrations/versions/128e042a2b68_ext_gw_mode.py index 8770b1e245..6b630dcb83 100644 --- a/neutron/db/migration/alembic_migrations/versions/128e042a2b68_ext_gw_mode.py +++ b/neutron/db/migration/alembic_migrations/versions/128e042a2b68_ext_gw_mode.py @@ -46,8 +46,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.add_column('routers', sa.Column('enable_snat', sa.Boolean(), @@ -56,8 +56,8 @@ def upgrade(active_plugin=None, options=None): op.execute("UPDATE routers SET enable_snat=True") -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_column('routers', 'enable_snat') diff --git a/neutron/db/migration/alembic_migrations/versions/1341ed32cc1e_nvp_netbinding_update.py b/neutron/db/migration/alembic_migrations/versions/1341ed32cc1e_nvp_netbinding_update.py index 9c5cdc9282..9bff772983 100644 --- a/neutron/db/migration/alembic_migrations/versions/1341ed32cc1e_nvp_netbinding_update.py +++ b/neutron/db/migration/alembic_migrations/versions/1341ed32cc1e_nvp_netbinding_update.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.alter_column('nvp_network_bindings', 'tz_uuid', name='phy_uuid', @@ -53,8 +53,8 @@ def upgrade(active_plugin=None, options=None): existing_nullable=True) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.alter_column('nvp_network_bindings', 'phy_uuid', name='tz_uuid', diff --git a/neutron/db/migration/alembic_migrations/versions/13de305df56e_add_nec_pf_name.py b/neutron/db/migration/alembic_migrations/versions/13de305df56e_add_nec_pf_name.py index 727b492a04..17a951cd59 100644 --- a/neutron/db/migration/alembic_migrations/versions/13de305df56e_add_nec_pf_name.py +++ b/neutron/db/migration/alembic_migrations/versions/13de305df56e_add_nec_pf_name.py @@ -40,16 +40,16 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.add_column('packetfilters', sa.Column('name', sa.String(length=255), nullable=True)) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_column('packetfilters', 'name') diff --git a/neutron/db/migration/alembic_migrations/versions/176a85fc7d79_add_portbindings_db.py b/neutron/db/migration/alembic_migrations/versions/176a85fc7d79_add_portbindings_db.py index 6d21ab4747..4674852691 100644 --- a/neutron/db/migration/alembic_migrations/versions/176a85fc7d79_add_portbindings_db.py +++ b/neutron/db/migration/alembic_migrations/versions/176a85fc7d79_add_portbindings_db.py @@ -41,8 +41,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -54,7 +54,7 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('portbindingports') diff --git a/neutron/db/migration/alembic_migrations/versions/1b693c095aa3_quota_ext_db_grizzly.py b/neutron/db/migration/alembic_migrations/versions/1b693c095aa3_quota_ext_db_grizzly.py index eb33b0c861..2a50e4d5eb 100644 --- a/neutron/db/migration/alembic_migrations/versions/1b693c095aa3_quota_ext_db_grizzly.py +++ b/neutron/db/migration/alembic_migrations/versions/1b693c095aa3_quota_ext_db_grizzly.py @@ -39,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### @@ -55,8 +55,8 @@ def upgrade(active_plugin=None, options=None): ### end Alembic commands ### -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### diff --git a/neutron/db/migration/alembic_migrations/versions/1c33fa3cd1a1_extra_route_config.py b/neutron/db/migration/alembic_migrations/versions/1c33fa3cd1a1_extra_route_config.py index 107773b006..2d91fc6a83 100644 --- a/neutron/db/migration/alembic_migrations/versions/1c33fa3cd1a1_extra_route_config.py +++ b/neutron/db/migration/alembic_migrations/versions/1c33fa3cd1a1_extra_route_config.py @@ -43,8 +43,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.rename_table( @@ -63,8 +63,8 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.rename_table( diff --git a/neutron/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py b/neutron/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py index d38bae31af..47784d31d4 100644 --- a/neutron/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py +++ b/neutron/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py @@ -39,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -57,8 +57,8 @@ def upgrade(active_plugin=None, options=None): sa.PrimaryKeyConstraint('network_id')) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('nvp_network_bindings') diff --git a/neutron/db/migration/alembic_migrations/versions/2032abe8edac_lbaas_add_status_des.py b/neutron/db/migration/alembic_migrations/versions/2032abe8edac_lbaas_add_status_des.py index 2a91d0de5d..813f93e962 100644 --- a/neutron/db/migration/alembic_migrations/versions/2032abe8edac_lbaas_add_status_des.py +++ b/neutron/db/migration/alembic_migrations/versions/2032abe8edac_lbaas_add_status_des.py @@ -29,7 +29,9 @@ down_revision = '477a4488d3f4' # Change to ['*'] if this migration applies to all plugins -migration_for_plugins = ['*'] +migration_for_plugins = [ + 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin', +] from alembic import op import sqlalchemy as sa @@ -39,16 +41,16 @@ from neutron.db import migration ENTITIES = ['vips', 'pools', 'members', 'healthmonitors'] -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return for entity in ENTITIES: op.add_column(entity, sa.Column('status_description', sa.String(255))) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return for entity in ENTITIES: diff --git a/neutron/db/migration/alembic_migrations/versions/20ae61555e95_ml2_gre_type_driver.py b/neutron/db/migration/alembic_migrations/versions/20ae61555e95_ml2_gre_type_driver.py index 08e82a0e73..e63668c25d 100644 --- a/neutron/db/migration/alembic_migrations/versions/20ae61555e95_ml2_gre_type_driver.py +++ b/neutron/db/migration/alembic_migrations/versions/20ae61555e95_ml2_gre_type_driver.py @@ -39,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -58,8 +58,8 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('ml2_gre_allocations') diff --git a/neutron/db/migration/alembic_migrations/versions/263772d65691_cisco_db_cleanup_2.py b/neutron/db/migration/alembic_migrations/versions/263772d65691_cisco_db_cleanup_2.py index 646cbaccc5..bc1381cb42 100644 --- a/neutron/db/migration/alembic_migrations/versions/263772d65691_cisco_db_cleanup_2.py +++ b/neutron/db/migration/alembic_migrations/versions/263772d65691_cisco_db_cleanup_2.py @@ -39,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return if 'credentials' in sa.MetaData().tables: @@ -53,8 +53,8 @@ def upgrade(active_plugin=None, options=None): op.drop_table('cisco_vlan_ids') -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( diff --git a/neutron/db/migration/alembic_migrations/versions/2a6d0b51f4bb_cisco_plugin_cleanup.py b/neutron/db/migration/alembic_migrations/versions/2a6d0b51f4bb_cisco_plugin_cleanup.py index bceac0ed7a..efc84e97db 100644 --- a/neutron/db/migration/alembic_migrations/versions/2a6d0b51f4bb_cisco_plugin_cleanup.py +++ b/neutron/db/migration/alembic_migrations/versions/2a6d0b51f4bb_cisco_plugin_cleanup.py @@ -39,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table(u'port_bindings') @@ -49,8 +49,8 @@ def upgrade(active_plugin=None, options=None): op.drop_table(u'portprofile_bindings') -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( diff --git a/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py b/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py index 63a46112ec..f142fc38f9 100644 --- a/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py +++ b/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py @@ -40,13 +40,13 @@ from neutron.db import migration from neutron.db.migration.alembic_migrations import common_ext_ops -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return common_ext_ops.upgrade_l3() -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return common_ext_ops.downgrade_l3() diff --git a/neutron/db/migration/alembic_migrations/versions/32b517556ec9_remove_tunnelip_mode.py b/neutron/db/migration/alembic_migrations/versions/32b517556ec9_remove_tunnelip_mode.py index 04f7012046..4c5c1e98be 100644 --- a/neutron/db/migration/alembic_migrations/versions/32b517556ec9_remove_tunnelip_mode.py +++ b/neutron/db/migration/alembic_migrations/versions/32b517556ec9_remove_tunnelip_mode.py @@ -40,15 +40,15 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('ovs_tunnel_ips') -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( diff --git a/neutron/db/migration/alembic_migrations/versions/35c7c198ddea_lbaas_healthmon_del_status.py b/neutron/db/migration/alembic_migrations/versions/35c7c198ddea_lbaas_healthmon_del_status.py index a0f9b83635..5741726942 100644 --- a/neutron/db/migration/alembic_migrations/versions/35c7c198ddea_lbaas_healthmon_del_status.py +++ b/neutron/db/migration/alembic_migrations/versions/35c7c198ddea_lbaas_healthmon_del_status.py @@ -29,7 +29,9 @@ down_revision = '11c6e18605c8' # Change to ['*'] if this migration applies to all plugins -migration_for_plugins = ['*'] +migration_for_plugins = [ + 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin', +] from alembic import op import sqlalchemy as sa @@ -38,15 +40,15 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_column('healthmonitors', 'status') op.drop_column('healthmonitors', 'status_description') -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.add_column('healthmonitors', sa.Column('status', diff --git a/neutron/db/migration/alembic_migrations/versions/363468ac592c_nvp_network_gw.py b/neutron/db/migration/alembic_migrations/versions/363468ac592c_nvp_network_gw.py index e011342ba4..64bdce4134 100644 --- a/neutron/db/migration/alembic_migrations/versions/363468ac592c_nvp_network_gw.py +++ b/neutron/db/migration/alembic_migrations/versions/363468ac592c_nvp_network_gw.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table('networkgateways', sa.Column('id', sa.String(length=36), nullable=False), @@ -88,8 +88,8 @@ def upgrade(active_plugin=None, options=None): 'segmentation_id')) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('networkconnections') diff --git a/neutron/db/migration/alembic_migrations/versions/38335592a0dc_nvp_portmap.py b/neutron/db/migration/alembic_migrations/versions/38335592a0dc_nvp_portmap.py index c07fc48249..fd9de4d308 100644 --- a/neutron/db/migration/alembic_migrations/versions/38335592a0dc_nvp_portmap.py +++ b/neutron/db/migration/alembic_migrations/versions/38335592a0dc_nvp_portmap.py @@ -39,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -52,8 +52,8 @@ def upgrade(active_plugin=None, options=None): sa.PrimaryKeyConstraint('neutron_id')) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('neutron_nvp_port_mapping') diff --git a/neutron/db/migration/alembic_migrations/versions/39cf3f799352_fwaas_havana_2_model.py b/neutron/db/migration/alembic_migrations/versions/39cf3f799352_fwaas_havana_2_model.py index 077f44f8d4..a114df1f8a 100644 --- a/neutron/db/migration/alembic_migrations/versions/39cf3f799352_fwaas_havana_2_model.py +++ b/neutron/db/migration/alembic_migrations/versions/39cf3f799352_fwaas_havana_2_model.py @@ -29,7 +29,9 @@ down_revision = 'e6b16a30d97' # Change to ['*'] if this migration applies to all plugins -migration_for_plugins = ['*'] +migration_for_plugins = [ + 'neutron.services.firewall.fwaas_plugin.FirewallPlugin', +] from alembic import op import sqlalchemy as sa @@ -37,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('firewall_rules') @@ -46,8 +48,8 @@ def downgrade(active_plugin=None, options=None): op.drop_table('firewall_policies') -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( diff --git a/neutron/db/migration/alembic_migrations/versions/3b54bf9e29f7_nec_plugin_sharednet.py b/neutron/db/migration/alembic_migrations/versions/3b54bf9e29f7_nec_plugin_sharednet.py index f1f0dd9da6..fb2b776f54 100644 --- a/neutron/db/migration/alembic_migrations/versions/3b54bf9e29f7_nec_plugin_sharednet.py +++ b/neutron/db/migration/alembic_migrations/versions/3b54bf9e29f7_nec_plugin_sharednet.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -74,8 +74,8 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('ofcfiltermappings') diff --git a/neutron/db/migration/alembic_migrations/versions/3cabb850f4a5_table_to_track_port_.py b/neutron/db/migration/alembic_migrations/versions/3cabb850f4a5_table_to_track_port_.py index b478828822..dbfdc59531 100644 --- a/neutron/db/migration/alembic_migrations/versions/3cabb850f4a5_table_to_track_port_.py +++ b/neutron/db/migration/alembic_migrations/versions/3cabb850f4a5_table_to_track_port_.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### @@ -54,8 +54,8 @@ def upgrade(active_plugin=None, options=None): ### end Alembic commands ### -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### diff --git a/neutron/db/migration/alembic_migrations/versions/3cb5d900c5de_security_groups.py b/neutron/db/migration/alembic_migrations/versions/3cb5d900c5de_security_groups.py index a5a65e1a73..ee07e3bd2c 100644 --- a/neutron/db/migration/alembic_migrations/versions/3cb5d900c5de_security_groups.py +++ b/neutron/db/migration/alembic_migrations/versions/3cb5d900c5de_security_groups.py @@ -43,8 +43,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### @@ -88,8 +88,8 @@ def upgrade(active_plugin=None, options=None): ### end Alembic commands ### -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### diff --git a/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py b/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py index aa55701239..0864f9a13f 100644 --- a/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py +++ b/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -53,8 +53,8 @@ def upgrade(active_plugin=None, options=None): sa.PrimaryKeyConstraint('port_id')) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('maclearningstates') diff --git a/neutron/db/migration/alembic_migrations/versions/45680af419f9_nvp_qos.py b/neutron/db/migration/alembic_migrations/versions/45680af419f9_nvp_qos.py index b30ec94f5f..9a2381aad3 100644 --- a/neutron/db/migration/alembic_migrations/versions/45680af419f9_nvp_qos.py +++ b/neutron/db/migration/alembic_migrations/versions/45680af419f9_nvp_qos.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### @@ -80,8 +80,8 @@ def upgrade(active_plugin=None, options=None): ### end Alembic commands ### -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### diff --git a/neutron/db/migration/alembic_migrations/versions/4692d074d587_agent_scheduler.py b/neutron/db/migration/alembic_migrations/versions/4692d074d587_agent_scheduler.py index c90aec2ae4..d89879cfd7 100644 --- a/neutron/db/migration/alembic_migrations/versions/4692d074d587_agent_scheduler.py +++ b/neutron/db/migration/alembic_migrations/versions/4692d074d587_agent_scheduler.py @@ -44,8 +44,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### @@ -73,8 +73,8 @@ def upgrade(active_plugin=None, options=None): ### end Alembic commands ### -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### diff --git a/neutron/db/migration/alembic_migrations/versions/477a4488d3f4_ml2_vxlan_type_driver.py b/neutron/db/migration/alembic_migrations/versions/477a4488d3f4_ml2_vxlan_type_driver.py index ecb8a5d9a7..a57617e445 100644 --- a/neutron/db/migration/alembic_migrations/versions/477a4488d3f4_ml2_vxlan_type_driver.py +++ b/neutron/db/migration/alembic_migrations/versions/477a4488d3f4_ml2_vxlan_type_driver.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -61,8 +61,8 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('ml2_vxlan_allocations') diff --git a/neutron/db/migration/alembic_migrations/versions/48b6f43f7471_service_type.py b/neutron/db/migration/alembic_migrations/versions/48b6f43f7471_service_type.py index 4c46a3554f..83f3e726b2 100644 --- a/neutron/db/migration/alembic_migrations/versions/48b6f43f7471_service_type.py +++ b/neutron/db/migration/alembic_migrations/versions/48b6f43f7471_service_type.py @@ -39,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -68,8 +68,8 @@ def upgrade(active_plugin=None, options=None): sa.PrimaryKeyConstraint(u'id', u'service_class', u'service_type_id')) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table(u'servicedefinitions') diff --git a/neutron/db/migration/alembic_migrations/versions/49332180ca96_ryu_plugin_update.py b/neutron/db/migration/alembic_migrations/versions/49332180ca96_ryu_plugin_update.py index 9c0df3491d..d444499624 100644 --- a/neutron/db/migration/alembic_migrations/versions/49332180ca96_ryu_plugin_update.py +++ b/neutron/db/migration/alembic_migrations/versions/49332180ca96_ryu_plugin_update.py @@ -39,15 +39,15 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('ofp_server') -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( diff --git a/neutron/db/migration/alembic_migrations/versions/511471cc46b_agent_ext_model_supp.py b/neutron/db/migration/alembic_migrations/versions/511471cc46b_agent_ext_model_supp.py index fa75e21fc2..c372b413e5 100644 --- a/neutron/db/migration/alembic_migrations/versions/511471cc46b_agent_ext_model_supp.py +++ b/neutron/db/migration/alembic_migrations/versions/511471cc46b_agent_ext_model_supp.py @@ -35,6 +35,7 @@ migration_for_plugins = [ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2', 'neutron.plugins.nec.nec_plugin.NECPluginV2', 'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2', + 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin', ] from alembic import op @@ -44,8 +45,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### @@ -67,8 +68,8 @@ def upgrade(active_plugin=None, options=None): ### end Alembic commands ### -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### diff --git a/neutron/db/migration/alembic_migrations/versions/52c5e4a18807_lbaas_pool_scheduler.py b/neutron/db/migration/alembic_migrations/versions/52c5e4a18807_lbaas_pool_scheduler.py index 93de5bbe69..345955a0f5 100644 --- a/neutron/db/migration/alembic_migrations/versions/52c5e4a18807_lbaas_pool_scheduler.py +++ b/neutron/db/migration/alembic_migrations/versions/52c5e4a18807_lbaas_pool_scheduler.py @@ -27,11 +27,19 @@ Create Date: 2013-06-14 03:23:47.815865 revision = '52c5e4a18807' down_revision = '2032abe8edac' +migration_for_plugins = [ + 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin', +] + from alembic import op import sqlalchemy as sa +from neutron.db import migration -def upgrade(active_plugin=None, options=None): + +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): + return ### commands auto generated by Alembic - please adjust! ### op.create_table( 'poolloadbalanceragentbindings', @@ -47,7 +55,9 @@ def upgrade(active_plugin=None, options=None): ### end Alembic commands ### -def downgrade(active_plugin=None, options=None): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): + return ### commands auto generated by Alembic - please adjust! ### op.drop_table('poolloadbalanceragentbindings') ### end Alembic commands ### diff --git a/neutron/db/migration/alembic_migrations/versions/52ff27f7567a_support_for_vpnaas.py b/neutron/db/migration/alembic_migrations/versions/52ff27f7567a_support_for_vpnaas.py index d3612a20f2..c83804e1bd 100644 --- a/neutron/db/migration/alembic_migrations/versions/52ff27f7567a_support_for_vpnaas.py +++ b/neutron/db/migration/alembic_migrations/versions/52ff27f7567a_support_for_vpnaas.py @@ -30,7 +30,7 @@ down_revision = '39cf3f799352' # Change to ['*'] if this migration applies to all plugins migration_for_plugins = [ - '*' + 'neutron.services.vpn.plugin.VPNPlugin', ] from alembic import op @@ -39,8 +39,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -172,8 +172,8 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('ipsecpeercidrs') diff --git a/neutron/db/migration/alembic_migrations/versions/54c2c487e913_lbaas.py b/neutron/db/migration/alembic_migrations/versions/54c2c487e913_lbaas.py index d9fff767e6..f40daf5e6f 100644 --- a/neutron/db/migration/alembic_migrations/versions/54c2c487e913_lbaas.py +++ b/neutron/db/migration/alembic_migrations/versions/54c2c487e913_lbaas.py @@ -38,8 +38,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -150,8 +150,8 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table(u'poolstatisticss') diff --git a/neutron/db/migration/alembic_migrations/versions/557edfc53098_new_service_types.py b/neutron/db/migration/alembic_migrations/versions/557edfc53098_new_service_types.py index daf9dbbffa..17492afc84 100644 --- a/neutron/db/migration/alembic_migrations/versions/557edfc53098_new_service_types.py +++ b/neutron/db/migration/alembic_migrations/versions/557edfc53098_new_service_types.py @@ -29,7 +29,9 @@ down_revision = '52c5e4a18807' # Change to ['*'] if this migration applies to all plugins -migration_for_plugins = ['*'] +migration_for_plugins = [ + 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin', +] from alembic import op import sqlalchemy as sa @@ -38,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( 'providerresourceassociations', @@ -53,8 +55,8 @@ def upgrade(active_plugin=None, options=None): op.drop_table('servicetypes') -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( 'servicetypes', diff --git a/neutron/db/migration/alembic_migrations/versions/5918cbddab04_add_tables_for_route.py b/neutron/db/migration/alembic_migrations/versions/5918cbddab04_add_tables_for_route.py index e6a325354c..946f9c08e3 100644 --- a/neutron/db/migration/alembic_migrations/versions/5918cbddab04_add_tables_for_route.py +++ b/neutron/db/migration/alembic_migrations/versions/5918cbddab04_add_tables_for_route.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table('routerrules', @@ -63,8 +63,8 @@ def upgrade(active_plugin=None, options=None): sa.PrimaryKeyConstraint('rule_id', 'nexthop')) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('nexthops') diff --git a/neutron/db/migration/alembic_migrations/versions/5a875d0e5c_ryu.py b/neutron/db/migration/alembic_migrations/versions/5a875d0e5c_ryu.py index b819b6d5d3..8eee238a1b 100644 --- a/neutron/db/migration/alembic_migrations/versions/5a875d0e5c_ryu.py +++ b/neutron/db/migration/alembic_migrations/versions/5a875d0e5c_ryu.py @@ -44,8 +44,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -66,8 +66,8 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('tunnelkeylasts') diff --git a/neutron/db/migration/alembic_migrations/versions/5ac71e65402c_ml2_initial.py b/neutron/db/migration/alembic_migrations/versions/5ac71e65402c_ml2_initial.py index d3e97d6424..9227197c77 100644 --- a/neutron/db/migration/alembic_migrations/versions/5ac71e65402c_ml2_initial.py +++ b/neutron/db/migration/alembic_migrations/versions/5ac71e65402c_ml2_initial.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### @@ -73,8 +73,8 @@ def upgrade(active_plugin=None, options=None): ### end Alembic commands ### -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return ### commands auto generated by Alembic - please adjust! ### diff --git a/neutron/db/migration/alembic_migrations/versions/b7a8863760e_rm_cisco_vlan_bindin.py b/neutron/db/migration/alembic_migrations/versions/b7a8863760e_rm_cisco_vlan_bindin.py index 87e573ada4..dcda4e6862 100644 --- a/neutron/db/migration/alembic_migrations/versions/b7a8863760e_rm_cisco_vlan_bindin.py +++ b/neutron/db/migration/alembic_migrations/versions/b7a8863760e_rm_cisco_vlan_bindin.py @@ -40,15 +40,15 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('cisco_vlan_bindings') -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( diff --git a/neutron/db/migration/alembic_migrations/versions/e6b16a30d97_cisco_provider_nets.py b/neutron/db/migration/alembic_migrations/versions/e6b16a30d97_cisco_provider_nets.py index 7a3c159af9..2e02ee9b96 100644 --- a/neutron/db/migration/alembic_migrations/versions/e6b16a30d97_cisco_provider_nets.py +++ b/neutron/db/migration/alembic_migrations/versions/e6b16a30d97_cisco_provider_nets.py @@ -40,8 +40,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -53,8 +53,8 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table('cisco_provider_networks') diff --git a/neutron/db/migration/alembic_migrations/versions/f489cf14a79c_lbaas_havana.py b/neutron/db/migration/alembic_migrations/versions/f489cf14a79c_lbaas_havana.py index 1a8f0fcae0..b2d07e607c 100644 --- a/neutron/db/migration/alembic_migrations/versions/f489cf14a79c_lbaas_havana.py +++ b/neutron/db/migration/alembic_migrations/versions/f489cf14a79c_lbaas_havana.py @@ -27,7 +27,9 @@ Create Date: 2013-02-04 16:32:32.048731 revision = 'f489cf14a79c' down_revision = 'grizzly' -migration_for_plugins = ['*'] +migration_for_plugins = [ + 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin', +] from alembic import op import sqlalchemy as sa @@ -35,8 +37,8 @@ import sqlalchemy as sa from neutron.db import migration -def upgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def upgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.create_table( @@ -147,8 +149,8 @@ def upgrade(active_plugin=None, options=None): ) -def downgrade(active_plugin=None, options=None): - if not migration.should_run(active_plugin, migration_for_plugins): +def downgrade(active_plugins=None, options=None): + if not migration.should_run(active_plugins, migration_for_plugins): return op.drop_table(u'poolstatisticss') diff --git a/neutron/db/migration/alembic_migrations/versions/folsom_initial.py b/neutron/db/migration/alembic_migrations/versions/folsom_initial.py index 8541a5d847..0f99d5bd57 100644 --- a/neutron/db/migration/alembic_migrations/versions/folsom_initial.py +++ b/neutron/db/migration/alembic_migrations/versions/folsom_initial.py @@ -64,29 +64,29 @@ from neutron.db.migration.alembic_migrations import common_ext_ops # NOTE: This is a special migration that creates a Folsom compatible database. -def upgrade(active_plugin=None, options=None): +def upgrade(active_plugins=None, options=None): # general model upgrade_base() - if active_plugin in L3_CAPABLE: + if set(active_plugins) & set(L3_CAPABLE): common_ext_ops.upgrade_l3() - if active_plugin in FOLSOM_QUOTA: + if set(active_plugins) & set(FOLSOM_QUOTA): common_ext_ops.upgrade_quota(options) - if active_plugin == PLUGINS['lbr']: + if PLUGINS['lbr'] in active_plugins: upgrade_linuxbridge() - elif active_plugin == PLUGINS['ovs']: + elif PLUGINS['ovs'] in active_plugins: upgrade_ovs() - elif active_plugin == PLUGINS['cisco']: + elif PLUGINS['cisco'] in active_plugins: upgrade_cisco() # Cisco plugin imports OVS models too upgrade_ovs() - elif active_plugin == PLUGINS['meta']: + elif PLUGINS['meta'] in active_plugins: upgrade_meta() - elif active_plugin == PLUGINS['nec']: + elif PLUGINS['nec'] in active_plugins: upgrade_nec() - elif active_plugin == PLUGINS['ryu']: + elif PLUGINS['ryu'] in active_plugins: upgrade_ryu() @@ -428,26 +428,26 @@ def upgrade_cisco(): ) -def downgrade(active_plugin=None, options=None): - if active_plugin == PLUGINS['lbr']: +def downgrade(active_plugins=None, options=None): + if PLUGINS['lbr'] in active_plugins: downgrade_linuxbridge() - elif active_plugin == PLUGINS['ovs']: + elif PLUGINS['ovs'] in active_plugins: downgrade_ovs() - elif active_plugin == PLUGINS['cisco']: + elif PLUGINS['cisco'] in active_plugins: # Cisco plugin imports OVS models too downgrade_ovs() downgrade_cisco() - elif active_plugin == PLUGINS['meta']: + elif PLUGINS['meta'] in active_plugins: downgrade_meta() - elif active_plugin == PLUGINS['nec']: + elif PLUGINS['nec'] in active_plugins: downgrade_nec() - elif active_plugin == PLUGINS['ryu']: + elif PLUGINS['ryu'] in active_plugins: downgrade_ryu() - if active_plugin in FOLSOM_QUOTA: + if set(active_plugins) & set(FOLSOM_QUOTA): common_ext_ops.downgrade_quota(options) - if active_plugin in L3_CAPABLE: + if set(active_plugins) & set(L3_CAPABLE): common_ext_ops.downgrade_l3() downgrade_base() diff --git a/neutron/db/migration/alembic_migrations/versions/grizzly_release.py b/neutron/db/migration/alembic_migrations/versions/grizzly_release.py index 65368fb9f3..a7a25652f3 100644 --- a/neutron/db/migration/alembic_migrations/versions/grizzly_release.py +++ b/neutron/db/migration/alembic_migrations/versions/grizzly_release.py @@ -32,11 +32,11 @@ down_revision = '1341ed32cc1e' migration_for_plugins = ['*'] -def upgrade(active_plugin=None, options=None): +def upgrade(active_plugins=None, options=None): """A no-op migration for marking the Grizzly release.""" pass -def downgrade(active_plugin=None, options=None): +def downgrade(active_plugins=None, options=None): """A no-op migration for marking the Grizzly release.""" pass diff --git a/neutron/db/migration/cli.py b/neutron/db/migration/cli.py index 759c586e13..a1851b72a0 100644 --- a/neutron/db/migration/cli.py +++ b/neutron/db/migration/cli.py @@ -30,6 +30,9 @@ _core_opts = [ cfg.StrOpt('core_plugin', default='', help=_('Neutron plugin provider module')), + cfg.ListOpt('service_plugins', + default=[], + help=_("The service plugins Neutron will use")), ] _quota_opts = [ diff --git a/neutron/tests/unit/test_db_migration.py b/neutron/tests/unit/test_db_migration.py index 608fa757bb..2c3a7928fc 100644 --- a/neutron/tests/unit/test_db_migration.py +++ b/neutron/tests/unit/test_db_migration.py @@ -28,11 +28,11 @@ from neutron.tests import base class TestDbMigration(base.BaseTestCase): def test_should_run_plugin_in_list(self): - self.assertTrue(migration.should_run('foo', ['foo', 'bar'])) - self.assertFalse(migration.should_run('foo', ['bar'])) + self.assertTrue(migration.should_run(['foo'], ['foo', 'bar'])) + self.assertFalse(migration.should_run(['foo'], ['bar'])) def test_should_run_plugin_wildcard(self): - self.assertTrue(migration.should_run('foo', ['*'])) + self.assertTrue(migration.should_run(['foo'], ['*'])) class TestCli(base.BaseTestCase):