]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Migration support for Mellanox Neutron plugin
authorItzik Brown <itzikb@dev.mellanox.co.il>
Sun, 12 Jan 2014 12:31:18 +0000 (14:31 +0200)
committerItzik Brown <itzikb@dev.mellanox.co.il>
Sun, 9 Mar 2014 13:21:47 +0000 (15:21 +0200)
Adding initial version before Havana to enable
migration from Havana and including recent changes
for IceHouse.

Closes-Bug: 1265080

Change-Id: I4b18d6d7eb40a9e3b2f3bceaa750827f3ed7c93d

neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py
neutron/db/migration/alembic_migrations/versions/40b0aff0302e_mlnx_initial.py [new file with mode: 0644]
neutron/db/migration/alembic_migrations/versions/511471cc46b_agent_ext_model_supp.py
neutron/db/migration/alembic_migrations/versions/folsom_initial.py
neutron/db/migration/alembic_migrations/versions/havana_release.py

index a55f0b49eea11fd47ab1f3c5a2c92f056094acbc..e74a8be42808f6ccfd7cd66192b24170c4c83229 100644 (file)
@@ -39,6 +39,7 @@ migration_for_plugins = [
     'neutron.services.loadbalancer.plugin.LoadBalancerPlugin',
     'neutron.plugins.ibm.sdnve_neutron_plugin.SdnvePluginV2',
     'neutron.plugins.oneconvergence.plugin.OneConvergencePluginV2',
+    'neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin',
 ]
 
 from alembic import op
diff --git a/neutron/db/migration/alembic_migrations/versions/40b0aff0302e_mlnx_initial.py b/neutron/db/migration/alembic_migrations/versions/40b0aff0302e_mlnx_initial.py
new file mode 100644 (file)
index 0000000..7da75d9
--- /dev/null
@@ -0,0 +1,194 @@
+# Copyright 2014 OpenStack Foundation
+#
+#    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.
+#
+
+"""mlnx_initial
+
+Revision ID: 40b0aff0302e
+Revises: 49f5e553f61f
+Create Date: 2014-01-12 14:51:49.273105
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '40b0aff0302e'
+down_revision = '49f5e553f61f'
+
+# Change to ['*'] if this migration applies to all plugins
+
+migration_for_plugins = [
+    'neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin'
+]
+
+from alembic import op
+import sqlalchemy as sa
+
+from neutron.db import migration
+
+
+def upgrade(active_plugins=None, options=None):
+    if not migration.should_run(active_plugins, migration_for_plugins):
+        return
+
+    op.create_table(
+        'securitygroups',
+        sa.Column('tenant_id', sa.String(length=255), nullable=True),
+        sa.Column('id', sa.String(length=36), nullable=False),
+        sa.Column('name', sa.String(length=255), nullable=True),
+        sa.Column('description', sa.String(length=255), nullable=True),
+        sa.PrimaryKeyConstraint('id'),
+    )
+
+    op.create_table(
+        'segmentation_id_allocation',
+        sa.Column('physical_network', sa.String(length=64), nullable=False),
+        sa.Column('segmentation_id', sa.Integer(), autoincrement=False,
+                  nullable=False),
+        sa.Column('allocated', sa.Boolean(), nullable=False),
+        sa.PrimaryKeyConstraint('physical_network', 'segmentation_id'),
+    )
+
+    op.create_table(
+        'quotas',
+        sa.Column('id', sa.String(length=36), nullable=False),
+        sa.Column('tenant_id', sa.String(255), index=True),
+        sa.Column('resource', sa.String(255)),
+        sa.Column('limit', sa.Integer()),
+        sa.PrimaryKeyConstraint('id')
+    )
+
+    op.create_table(
+        'mlnx_network_bindings',
+        sa.Column('network_id', sa.String(length=36), nullable=False),
+        sa.Column('network_type', sa.String(length=32), nullable=False),
+        sa.Column('physical_network', sa.String(length=64), nullable=True),
+        sa.Column('segmentation_id', sa.Integer(), nullable=False),
+        sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
+                                ondelete='CASCADE'),
+        sa.PrimaryKeyConstraint('network_id'),
+    )
+
+    op.create_table(
+        'networkdhcpagentbindings',
+        sa.Column('network_id', sa.String(length=36), nullable=False),
+        sa.Column('dhcp_agent_id', sa.String(length=36), nullable=False),
+        sa.ForeignKeyConstraint(['dhcp_agent_id'], ['agents.id'],
+                                ondelete='CASCADE'),
+        sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
+                                ondelete='CASCADE'),
+        sa.PrimaryKeyConstraint('network_id', 'dhcp_agent_id'),
+    )
+
+    op.create_table(
+        'securitygrouprules',
+        sa.Column('tenant_id', sa.String(length=255), nullable=True),
+        sa.Column('id', sa.String(length=36), nullable=False),
+        sa.Column('security_group_id', sa.String(length=36), nullable=False),
+        sa.Column('remote_group_id', sa.String(length=36), nullable=True),
+        sa.Column('direction',
+                  sa.Enum('ingress', 'egress',
+                          name='securitygrouprules_direction'),
+                  nullable=True),
+        sa.Column('ethertype', sa.String(length=40), nullable=True),
+        sa.Column('protocol', sa.String(length=40), nullable=True),
+        sa.Column('port_range_min', sa.Integer(), nullable=True),
+        sa.Column('port_range_max', sa.Integer(), nullable=True),
+        sa.Column('remote_ip_prefix', sa.String(length=255), nullable=True),
+        sa.ForeignKeyConstraint(['remote_group_id'], ['securitygroups.id'],
+                                ondelete='CASCADE'),
+        sa.ForeignKeyConstraint(['security_group_id'], ['securitygroups.id'],
+                                ondelete='CASCADE'),
+        sa.PrimaryKeyConstraint('id'),
+    )
+
+    op.create_table(
+        'port_profile',
+        sa.Column('port_id', sa.String(length=36), nullable=False),
+        sa.Column('vnic_type', sa.String(length=32), nullable=False),
+        sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
+                                ondelete='CASCADE'),
+        sa.PrimaryKeyConstraint('port_id'),
+    )
+
+    op.add_column('routers', sa.Column('enable_snat', sa.Boolean(),
+                                       nullable=False, default=True))
+    op.create_table(
+        'securitygroupportbindings',
+        sa.Column('port_id', sa.String(length=36), nullable=False),
+        sa.Column('security_group_id', sa.String(length=36), nullable=False),
+        sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
+                                ondelete='CASCADE'),
+        sa.ForeignKeyConstraint(['security_group_id'], ['securitygroups.id'],),
+        sa.PrimaryKeyConstraint('port_id', 'security_group_id'),
+    )
+
+    op.create_table(
+        'portbindingports',
+        sa.Column('port_id', sa.String(length=36), nullable=False),
+        sa.Column('host', sa.String(length=255), nullable=False),
+        sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
+                                ondelete='CASCADE'),
+        sa.PrimaryKeyConstraint('port_id'),
+    )
+
+    op.rename_table(
+        'routes',
+        'subnetroutes',
+    )
+
+    op.create_table(
+        'routerl3agentbindings',
+        sa.Column('id', sa.String(length=36), nullable=False),
+        sa.Column('router_id', sa.String(length=36), nullable=True),
+        sa.Column('l3_agent_id', sa.String(length=36), nullable=True),
+        sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'],
+                                ondelete='CASCADE'),
+
+        sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
+                                ondelete='CASCADE'),
+        sa.PrimaryKeyConstraint('id'),
+    )
+
+    op.create_table(
+        'routerroutes',
+        sa.Column('destination', sa.String(length=64), nullable=False),
+        sa.Column('nexthop', sa.String(length=64), nullable=False),
+        sa.Column('router_id', sa.String(length=36), nullable=False),
+        sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
+                                ondelete='CASCADE'),
+        sa.PrimaryKeyConstraint('destination', 'nexthop', 'router_id'),
+    )
+
+
+def downgrade(active_plugins=None, options=None):
+    if not migration.should_run(active_plugins, migration_for_plugins):
+        return
+
+    op.rename_table(
+        'subnetroutes',
+        'routes',
+    )
+
+    op.drop_table('routerroutes')
+    op.drop_table('routerl3agentbindings')
+    op.drop_table('portbindingports')
+    op.drop_table('securitygroupportbindings')
+    op.drop_column('routers', 'enable_snat')
+    op.drop_table('port_profile')
+    op.drop_table('securitygrouprules')
+    op.drop_table('networkdhcpagentbindings')
+    op.drop_table('mlnx_network_bindings')
+    op.drop_table('quotas')
+    op.drop_table('segmentation_id_allocation')
+    op.drop_table('securitygroups')
index 12d75aa9ef69f5449e078f745f5fea6dcc110a35..c1ebf469d9f13b87227cc038d2e7e716bbddb05a 100644 (file)
@@ -41,6 +41,7 @@ migration_for_plugins = [
     'neutron.services.loadbalancer.plugin.LoadBalancerPlugin',
     'neutron.plugins.ibm.sdnve_neutron_plugin.SdnvePluginV2',
     'neutron.plugins.oneconvergence.plugin.OneConvergencePluginV2',
+    'neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin',
 ]
 
 from alembic import op
index 15a0e69046acf29ee30cd670dc2ccffca14495e5..9344065ec5c85588824813816a4f8ec92b0c1e4e 100644 (file)
@@ -31,6 +31,7 @@ PLUGINS = {
     'lbr': 'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
     'meta': 'neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2',
     'ml2': 'neutron.plugins.ml2.plugin.Ml2Plugin',
+    'mlnx': 'neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin',
     'nec': 'neutron.plugins.nec.nec_plugin.NECPluginV2',
     'nvp': 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
     'ocnvsd': 'neutron.plugins.oneconvergence.plugin.OneConvergencePluginV2',
@@ -45,6 +46,7 @@ L3_CAPABLE = [
     PLUGINS['lbr'],
     PLUGINS['meta'],
     PLUGINS['ml2'],
+    PLUGINS['mlnx'],
     PLUGINS['nec'],
     PLUGINS['ocnvsd'],
     PLUGINS['ovs'],
index 5fd9a363358b37957e46f8fbb59d756d7fbca5ad..5be1e0676c3b7b7e4044406f560d4008d55803d2 100644 (file)
 """havana
 
 Revision ID: havana
-Revises: 49f5e553f61f
+Revises: 40b0aff0302e
 Create Date: 2013-10-02 00:00:00.000000
 
 """
 
 # revision identifiers, used by Alembic.
 revision = 'havana'
-down_revision = '49f5e553f61f'
+down_revision = '40b0aff0302e'
 
 # Change to ['*'] if this migration applies to all plugins