From 45e8c6ae0ca1a4e41bf991377fd8242853ad451b Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 5 Sep 2022 16:57:17 +0100 Subject: [PATCH] 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, Aodh is currently relying on the autocommit behavior and needs changes to explicitly manage sessions. Until that happens, we need to override the default. Signed-off-by: Stephen Finucane Change-Id: I129b54b06e1a5c3fafd2a03f295cc1cfd9c9e33c --- aodh/storage/impl_sqlalchemy.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aodh/storage/impl_sqlalchemy.py b/aodh/storage/impl_sqlalchemy.py index bfd7d9503..6a9d02b74 100644 --- a/aodh/storage/impl_sqlalchemy.py +++ b/aodh/storage/impl_sqlalchemy.py @@ -106,6 +106,10 @@ class Connection(base.Connection): # in storage.__init__.get_connection_from_config function options = dict(conf.database.items()) options['max_retries'] = 0 + # FIXME(stephenfin): Remove this (and ideally use of + # LegacyEngineFacade) asap since it's not compatible with SQLAlchemy + # 2.0 + options['autocommit'] = True # oslo.db doesn't support options defined by Aodh for opt in storage.OPTS: options.pop(opt.name, None)