From: Hareesh Puthalath Date: Thu, 13 Mar 2014 21:06:23 +0000 (+0100) Subject: Include cisco plugin in migration plugins with ovs X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f23d081b26071e1b309f49e5a5ab0cdc1a739e9d;p=openstack-build%2Fneutron-build.git Include cisco plugin in migration plugins with ovs Currently we have many migration files with missing cisco plugin in migrate_plugin when ovs is included.This causes missing tables when cisco plugin is enabled and migration is run. This fix should automatically include the cisco plugin if ovs is detected in the migrate_plugins. Change-Id: I4dedfbafe9b431e85255d5427766e22eed09ee5e Closes-Bug: #1292114 --- diff --git a/neutron/db/migration/__init__.py b/neutron/db/migration/__init__.py index 93a0e0280..4151770e8 100644 --- a/neutron/db/migration/__init__.py +++ b/neutron/db/migration/__init__.py @@ -14,9 +14,16 @@ # # @author: Mark McClain, DreamHost +OVS_PLUGIN = ('neutron.plugins.openvswitch.ovs_neutron_plugin' + '.OVSNeutronPluginV2') +CISCO_PLUGIN = 'neutron.plugins.cisco.network_plugin.PluginV2' + def should_run(active_plugins, migrate_plugins): if '*' in migrate_plugins: return True else: + if (CISCO_PLUGIN not in migrate_plugins and + OVS_PLUGIN in migrate_plugins): + migrate_plugins.append(CISCO_PLUGIN) return set(active_plugins) & set(migrate_plugins) 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 61ba088d3..82aa30602 100644 --- a/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py +++ b/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py @@ -38,7 +38,6 @@ migration_for_plugins = [ 'neutron.plugins.vmware.plugin.NsxPlugin', 'neutron.plugins.vmware.plugin.NsxServicePlugin', 'neutron.plugins.embrane.plugins.embrane_ovs_plugin.EmbraneOvsPlugin', - 'neutron.plugins.cisco.network_plugin.PluginV2', ] from neutron.db import migration diff --git a/neutron/db/migration/alembic_migrations/versions/folsom_initial.py b/neutron/db/migration/alembic_migrations/versions/folsom_initial.py index 3241d1afd..a6dab6188 100644 --- a/neutron/db/migration/alembic_migrations/versions/folsom_initial.py +++ b/neutron/db/migration/alembic_migrations/versions/folsom_initial.py @@ -72,6 +72,7 @@ down_revision = None from alembic import op import sqlalchemy as sa +from neutron.db import migration from neutron.db.migration.alembic_migrations import common_ext_ops # NOTE: This is a special migration that creates a Folsom compatible database. @@ -80,10 +81,10 @@ def upgrade(active_plugins=None, options=None): # general model upgrade_base() - if set(active_plugins) & set(L3_CAPABLE): + if migration.should_run(active_plugins, L3_CAPABLE): common_ext_ops.upgrade_l3() - if set(active_plugins) & set(FOLSOM_QUOTA): + if migration.should_run(active_plugins, FOLSOM_QUOTA): common_ext_ops.upgrade_quota(options) if PLUGINS['lbr'] in active_plugins: @@ -484,10 +485,10 @@ def downgrade(active_plugins=None, options=None): downgrade_brocade() downgrade_linuxbridge() - if set(active_plugins) & set(FOLSOM_QUOTA): + if migration.should_run(active_plugins, FOLSOM_QUOTA): common_ext_ops.downgrade_quota(options) - if set(active_plugins) & set(L3_CAPABLE): + if migration.should_run(active_plugins, L3_CAPABLE): common_ext_ops.downgrade_l3() downgrade_base()