Adopt to oslo.db 12.1.0

Change-Id: Ic166fd810b1e49ac02d32921a6294e5f3c758489
This commit is contained in:
elajkat 2022-09-09 21:27:19 +02:00
parent 6eaed1cdba
commit 694c84c61b
2 changed files with 4 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import oslo_messaging
from neutron.db.models import l3agent
from neutron.db.models import servicetype
from neutron_lib import constants as lib_constants
from neutron_lib.db import api as db_api
from neutron_lib.plugins import directory
from neutron_vpnaas.db.vpn import vpn_models
@ -70,6 +71,7 @@ class IPsecVpnDriverCallBack(object):
self.driver.name)
return query
@db_api.CONTEXT_READER
def get_vpn_services_on_host(self, context, host=None):
"""Returns the vpnservices on the host."""
vpnservices = self._get_agent_hosting_vpn_services(

View File

@ -32,6 +32,7 @@ from neutron_lib.api.definitions import vpn
from neutron_lib.callbacks import events
from neutron_lib import constants as lib_constants
from neutron_lib import context
from neutron_lib.db import api as db_api
from neutron_lib.exceptions import l3 as l3_exception
from neutron_lib.exceptions import vpn as vpn_exception
from neutron_lib.plugins import constants as nconstants
@ -423,7 +424,7 @@ class VPNTestMixin(object):
def _set_active(self, model, resource_id):
service_plugin = directory.get_plugin(nconstants.VPN)
adminContext = context.get_admin_context()
with adminContext.session.begin(subtransactions=True):
with db_api.CONTEXT_WRITER.using(adminContext):
resource_db = service_plugin._get_resource(
adminContext,
model,