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.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I2e02b00309c8a0289954b7cd6838bd9320cec3e0
This commit is contained in:
Stephen Finucane 2022-09-05 17:19:48 +01:00
parent 729e3bf659
commit 7460ae30bf

View File

@ -62,6 +62,10 @@ def _create_facade_lazily(cfg_group, connection=None, discriminator=None):
if cache_name not in _FACADES:
conf = dict(cfg.CONF[cfg_group].items())
# FIXME(stephenfin): Remove this (and ideally use of
# LegacyEngineFacade) asap since it's not compatible with SQLAlchemy
# 2.0
conf['autocommit'] = True
_FACADES[cache_name] = session.EngineFacade(
connection,
**conf