From c7ed3b42f34ce9ff7de6ec0cb69527a5acf66010 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Wed, 16 Sep 2015 04:16:38 -0700 Subject: [PATCH] L2 gateway migration skip Skip l2 gw migration if the table does not exist Change-Id: Ib88e10e7c377d8dc1dece75fae1307174ff827cb --- ...70ac3ae8_nsxv3_add_l2gwconnection_table.py | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/vmware_nsx/db/migration/alembic_migrations/versions/liberty/expand/279b70ac3ae8_nsxv3_add_l2gwconnection_table.py b/vmware_nsx/db/migration/alembic_migrations/versions/liberty/expand/279b70ac3ae8_nsxv3_add_l2gwconnection_table.py index ae7d0f8f6c..00bc6e6632 100644 --- a/vmware_nsx/db/migration/alembic_migrations/versions/liberty/expand/279b70ac3ae8_nsxv3_add_l2gwconnection_table.py +++ b/vmware_nsx/db/migration/alembic_migrations/versions/liberty/expand/279b70ac3ae8_nsxv3_add_l2gwconnection_table.py @@ -30,14 +30,19 @@ import sqlalchemy as sa def upgrade(): - op.create_table( - 'nsx_l2gw_connection_mappings', - sa.Column('connection_id', sa.String(length=36), nullable=False), - sa.Column('port_id', sa.String(length=36), nullable=False), - sa.Column('bridge_endpoint_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['connection_id'], - ['l2gatewayconnections.id'], - ondelete='CASCADE'), - sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('connection_id'), - ) + try: + op.create_table( + 'nsx_l2gw_connection_mappings', + sa.Column('connection_id', sa.String(length=36), nullable=False), + sa.Column('port_id', sa.String(length=36), nullable=False), + sa.Column('bridge_endpoint_id', sa.String(length=36), + nullable=False), + sa.ForeignKeyConstraint(['connection_id'], + ['l2gatewayconnections.id'], + ondelete='CASCADE'), + sa.ForeignKeyConstraint(['port_id'], ['ports.id'], + ondelete='CASCADE'), + sa.PrimaryKeyConstraint('connection_id'), + ) + except Exception: + pass