]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
NSX: Allow multiple references to same gw device
authorSalvatore Orlando <salv.orlando@gmail.com>
Tue, 11 Mar 2014 23:16:10 +0000 (16:16 -0700)
committerSalvatore Orlando <salv.orlando@gmail.com>
Tue, 11 Mar 2014 23:20:01 +0000 (16:20 -0700)
This patch amends a data model in order to allow user to specify
the same gateway device multiple times in a network gateway
specification.

The corresponding migration is also being amended with this
patch. This approach has been preferred to developing another
migration since the migration being amended is still the most
recent one for the NSX plugin.

Change-Id: I4d24837d8d65fc45b838f3b616c9ec8a73a50d9c
Closes-Bug: 1262790

neutron/db/migration/alembic_migrations/versions/19180cf98af6_nsx_gw_devices.py
neutron/plugins/vmware/dbexts/networkgw_db.py

index 1e5ecc5ba9d10fcc70da93f958c0e701b3ceef5a..2eabc150a1271526d8b6dea29bb05d268afe7b53 100644 (file)
@@ -51,7 +51,7 @@ def upgrade(active_plugins=None, options=None):
         sa.Column('interface_name', sa.String(length=64), nullable=True),
         sa.ForeignKeyConstraint(['network_gateway_id'], ['networkgateways.id'],
                                 ondelete='CASCADE'),
-        sa.PrimaryKeyConstraint('id'),
+        sa.PrimaryKeyConstraint('id', 'network_gateway_id', 'interface_name'),
         mysql_engine='InnoDB')
     # Copy data from networkgatewaydevices into networkgatewaydevicereference
     op.execute("INSERT INTO networkgatewaydevicereferences SELECT "
index 5609a0867f49818faa148f7fb441881f399247be..6a1c3c21b3c5d6b3d17fd0190ad019b3d80e16ad 100644 (file)
@@ -121,8 +121,9 @@ class NetworkGatewayDeviceReference(model_base.BASEV2):
     id = sa.Column(sa.String(36), primary_key=True)
     network_gateway_id = sa.Column(sa.String(36),
                                    sa.ForeignKey('networkgateways.id',
-                                                 ondelete='CASCADE'))
-    interface_name = sa.Column(sa.String(64))
+                                                 ondelete='CASCADE'),
+                                   primary_key=True)
+    interface_name = sa.Column(sa.String(64), primary_key=True)
 
 
 class NetworkGatewayDevice(model_base.BASEV2, models_v2.HasId,