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:
@@ -50,12 +50,6 @@ def get_current_context():
|
|||||||
return get_obj_from_stack(n_context.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):
|
def get_resource_plural(resource):
|
||||||
if resource.endswith('y'):
|
if resource.endswith('y'):
|
||||||
resource_plural = resource.replace('y', 'ies')
|
resource_plural = resource.replace('y', 'ies')
|
||||||
|
|||||||
@@ -36,10 +36,6 @@ extensions.get_extensions_path = get_extensions_path
|
|||||||
from gbpservice.common import utils as gbp_utils
|
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
|
from neutron_lib import context as nlib_ctx
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
# that the patches are applied before any of the
|
# that the patches are applied before any of the
|
||||||
# modules save a reference to the functions being patched
|
# modules save a reference to the functions being patched
|
||||||
from gbpservice.neutron.extensions import patch # noqa
|
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 constants as n_const
|
||||||
from neutron.common import utils as n_utils
|
from neutron.common import utils as n_utils
|
||||||
@@ -222,12 +221,7 @@ class Ml2PlusPlugin(ml2_plugin.Ml2Plugin,
|
|||||||
plugin = directory.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
session = db_api.get_session_from_obj(subnetdb)
|
session = db_api.get_session_from_obj(subnetdb)
|
||||||
if not session:
|
if not session:
|
||||||
# REVISIT: For GBP workflows, getting a
|
session = db_api.get_writer_session()
|
||||||
# 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()
|
|
||||||
# REVISIT: Check if transaction begin is still
|
# REVISIT: Check if transaction begin is still
|
||||||
# required here, and if so, if reader pattern
|
# required here, and if so, if reader pattern
|
||||||
# can be used instead (will require getting the
|
# can be used instead (will require getting the
|
||||||
@@ -245,12 +239,7 @@ class Ml2PlusPlugin(ml2_plugin.Ml2Plugin,
|
|||||||
plugin = directory.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
session = db_api.get_session_from_obj(subnetdb)
|
session = db_api.get_session_from_obj(subnetdb)
|
||||||
if not session:
|
if not session:
|
||||||
# REVISIT: For GBP workflows, getting a
|
session = db_api.get_writer_session()
|
||||||
# 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()
|
|
||||||
with session.begin(subtransactions=True):
|
with session.begin(subtransactions=True):
|
||||||
plugin.extension_manager.extend_subnet_dict_bulk(session, results)
|
plugin.extension_manager.extend_subnet_dict_bulk(session, results)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user