Fix compatibility with oslo.db 12.1.0

oslo.db 12.1.0 has changed the default value for the 'autocommit'
parameter of 'LegacyEngineFacade' from 'True' to 'False'. This is a
necessary step to ensure compatibility with SQLAlchemy 2.0. However, we
are currently relying on the autocommit behavior and need changes to
explicitly manage sessions. Until that happens, we need to override the
default.

Also squashed change: [CI] move queue setting to project level

Jobs are currently not running. Fix as described in [1][2]

[1] https://lists.opendev.org/pipermail/service-announce/2022-September/000044.html
[2] https://lists.zuul-ci.org/pipermail/zuul-discuss/2022-May/001801.html

Story: 2010296
Co-Authored-By: Stephen Finucane <stephenfin@redhat.com>
Co-Authored-By: Jake Yip <jake.yip@ardc.edu.au>
Change-Id: I625500d9e6670a429c70a0f6d582d0865ce78fd1
(cherry picked from commit fd6f2d52386036cc652d59b43c9aba9efe962950)
This commit is contained in:
karolinku 2022-09-19 14:57:14 +02:00 committed by Jake Yip
parent fe0d9fc353
commit 1347a591c5
2 changed files with 4 additions and 2 deletions
.zuul.yaml
magnum/db/sqlalchemy

@ -50,6 +50,7 @@
timeout: 2400
- project:
queue: magnum
templates:
- openstack-cover-jobs
- openstack-python3-zed-jobs
@ -61,7 +62,6 @@
- magnum-tempest-plugin-tests-api
- magnum-container-build
gate:
queue: magnum
jobs:
- magnum-tempest-plugin-tests-api
post:

@ -48,7 +48,9 @@ _FACADE = None
def _create_facade_lazily():
global _FACADE
if _FACADE is None:
_FACADE = db_session.EngineFacade.from_config(CONF)
# FIXME(karolinku): autocommit=True it's not compatible with
# SQLAlchemy 2.0, and will be removed in future
_FACADE = db_session.EngineFacade.from_config(CONF, autocommit=True)
if profiler_sqlalchemy:
if CONF.profiler.enabled and CONF.profiler.trace_sqlalchemy:
profiler_sqlalchemy.add_tracing(sa, _FACADE.get_engine(), "db")