Remove get_current_session

Patch 9d15b98261 backed out the calls
to get_current_session for most resource extension calls. This patch
completes the removal, as this call isn't needed beyond stable/queens.

Change-Id: I7072c816500acac14c99776b923eb0ee4f0ee1e8
This commit is contained in:
Thomas Bachman 2020-08-05 19:06:27 +00:00
parent 9d15b98261
commit dffc392aec
3 changed files with 2 additions and 23 deletions

View File

@ -50,12 +50,6 @@ def get_current_context():
return get_obj_from_stack(n_context.Context)
def get_current_session():
ctx = get_current_context()
if ctx:
return ctx.session
def get_resource_plural(resource):
if resource.endswith('y'):
resource_plural = resource.replace('y', 'ies')

View File

@ -36,10 +36,6 @@ extensions.get_extensions_path = get_extensions_path
from gbpservice.common import utils as gbp_utils
def get_current_session():
return gbp_utils.get_current_session()
from neutron_lib import context as nlib_ctx

View File

@ -17,7 +17,6 @@
# that the patches are applied before any of the
# modules save a reference to the functions being patched
from gbpservice.neutron.extensions import patch # noqa
from gbpservice.neutron.plugins.ml2plus import patch_neutron # noqa
from neutron.common import constants as n_const
from neutron.common import utils as n_utils
@ -222,12 +221,7 @@ class Ml2PlusPlugin(ml2_plugin.Ml2Plugin,
plugin = directory.get_plugin()
session = db_api.get_session_from_obj(subnetdb)
if not session:
# REVISIT: For GBP workflows, getting a
# new writer session causes rollbacks in
# outer sessions to fail. This seems to
# be okay for other resources, as well
# as post-queens.
session = patch_neutron.get_current_session()
session = db_api.get_writer_session()
# REVISIT: Check if transaction begin is still
# required here, and if so, if reader pattern
# can be used instead (will require getting the
@ -245,12 +239,7 @@ class Ml2PlusPlugin(ml2_plugin.Ml2Plugin,
plugin = directory.get_plugin()
session = db_api.get_session_from_obj(subnetdb)
if not session:
# REVISIT: For GBP workflows, getting a
# new writer session causes rollbacks in
# outer sessions to fail. This seems to
# be okay for other resources, as well
# as post-queens.
session = patch_neutron.get_current_session()
session = db_api.get_writer_session()
with session.begin(subtransactions=True):
plugin.extension_manager.extend_subnet_dict_bulk(session, results)