Make cisco_csr_identifier migration conditional

neutron dropped 'cisco_csr_identifier_map' table in
[1], this makes migrations for that table conditional.

[1] https://review.opendev.org/c/openstack/neutron/+/897472
Related-Bug: #2038555

Change-Id: I31f2175cfc91a1d2bcb15b8911b2e323af25740d
This commit is contained in:
yatinkarel 2023-10-13 10:26:19 +05:30
parent b4c2bc4af6
commit e944dc144c
4 changed files with 15 additions and 0 deletions

View File

@ -22,6 +22,7 @@ Create Date: 2015-08-20 15:17:09.897944
"""
from alembic import op
import sqlalchemy as sa
from neutron.db import migration
@ -35,4 +36,7 @@ neutron_milestone = [migration.LIBERTY]
def upgrade():
insp = sa.inspect(op.get_bind())
if 'cisco_csr_identifier_map' not in insp.get_table_names():
return
op.drop_column('cisco_csr_identifier_map', 'tenant_id')

View File

@ -58,6 +58,9 @@ def _migrate_external_ips(engine):
addresses for an IP version, then only the first one will
be stored (the same as the reference driver does).
"""
insp = sa.inspect(engine)
if 'cisco_csr_identifier_map' not in insp.get_table_names():
return
session = sa.orm.Session(bind=engine.connect())
services = session.query(VPNService).all()
for service in services:

View File

@ -38,6 +38,9 @@ branch_labels = (cli.CONTRACT_BRANCH,)
def upgrade():
insp = sa.inspect(op.get_bind())
if 'cisco_csr_identifier_map' not in insp.get_table_names():
return
# re-size existing data if necessary
identifier_map = table('cisco_csr_identifier_map',
column('ipsec_site_conn_id', sa.String(36)))

View File

@ -22,6 +22,8 @@ Create Date: 2018-02-28 10:28:59.846652
"""
from alembic import op
import sqlalchemy as sa
from neutron.db import migration
# revision identifiers, used by Alembic.
@ -34,4 +36,7 @@ neutron_milestone = [migration.ROCKY, migration.STEIN,
def upgrade():
insp = sa.inspect(op.get_bind())
if 'cisco_csr_identifier_map' not in insp.get_table_names():
return
op.drop_table('cisco_csr_identifier_map')