Add reader context to get_ipsec_site_connection(s)

The following methods are now called from inside a reader context:
* ``VPNPluginDb.get_ipsec_site_connection``
* ``VPNPluginDb.get_ipsec_site_connections``

This avoids logged exceptions "ORM session: SQL execution without
transaction in progress"

Related-Bug: #2080072
Change-Id: I6555419c582b3c8654b13731d0b7c7fd61942957
This commit is contained in:
Bodo Petermann 2024-09-11 11:17:55 +02:00
parent 58d8ce0546
commit bd3f5f7e7b

View File

@ -263,6 +263,7 @@ class VPNPluginDb(vpnaas.VPNPluginBase,
return self._get_resource(
context, vpn_models.IPsecSiteConnection, ipsec_site_conn_id)
@db_api.CONTEXT_READER
def get_ipsec_site_connection(self, context,
ipsec_site_conn_id, fields=None):
ipsec_site_conn_db = self._get_ipsec_site_connection(
@ -270,6 +271,7 @@ class VPNPluginDb(vpnaas.VPNPluginBase,
return self._make_ipsec_site_connection_dict(
ipsec_site_conn_db, fields)
@db_api.CONTEXT_READER
def get_ipsec_site_connections(self, context, filters=None, fields=None):
return model_query.get_collection(
context, vpn_models.IPsecSiteConnection,