NSX: Allow multiple references to same gw device

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
This commit is contained in:
Salvatore Orlando 2014-03-11 16:16:10 -07:00
parent 4ea3af261c
commit a29fa2983e
2 changed files with 4 additions and 3 deletions

View 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 "

View 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,