Fix migration script to adopt to SQLAlclehym 2.0
* subtransactions was removed in SQLAlchemy 2.0[1]. * autocommit was removed from SQLAlchemy 2.0 and oslo.db no longer supports it since 12.1.0 . [1] https://docs.sqlalchemy.org/en/20/changelog/migration_20.html#migration-to-2-0-step-five-use-the-future-flag-on-session Change-Id: Ife9dd679a3956633785300fcec2c82231ef5e748
This commit is contained in:
parent
1567e1ec1c
commit
0cedfc4eb9
@ -38,7 +38,7 @@ def setup_conf():
|
||||
def migrate_fwaas_v1_to_v2(db_session):
|
||||
# the entire migration process will be done under the same transaction to
|
||||
# allow full rollback in case of error
|
||||
with db_session.begin(subtransactions=True):
|
||||
with db_session.begin():
|
||||
# Read all V1 policies
|
||||
v1_policies = db_session.query(firewall_db_v1.FirewallPolicy)
|
||||
|
||||
@ -131,7 +131,7 @@ def main():
|
||||
neutron_context_manager.configure(
|
||||
connection=cfg.CONF.neutron_db_connection)
|
||||
n_session_maker = neutron_context_manager.writer.get_sessionmaker()
|
||||
n_session = n_session_maker(autocommit=True)
|
||||
n_session = n_session_maker()
|
||||
|
||||
# Run DB migration
|
||||
migrate_fwaas_v1_to_v2(n_session)
|
||||
|
Loading…
x
Reference in New Issue
Block a user