diff --git a/neutron/db/api.py b/neutron/db/api.py index 10124515da0..39df781cdfe 100644 --- a/neutron/db/api.py +++ b/neutron/db/api.py @@ -122,11 +122,9 @@ def get_engine(): return context_manager.get_legacy_facade().get_engine() +@removals.remove(version='newton', removal_version='Ocata') def dispose(): - # TODO(akamyshnikova): Use context_manager.dispose_pool() when it is - # available in oslo.db - if context_manager._factory._started: - get_engine().pool.dispose() + context_manager.dispose_pool() #TODO(akamyshnikova): when all places in the code, which use sessions/ diff --git a/neutron/service.py b/neutron/service.py index 236b3be2a3c..27bca9dfddb 100644 --- a/neutron/service.py +++ b/neutron/service.py @@ -245,7 +245,7 @@ def _start_workers(workers): # dispose the whole pool before os.fork, otherwise there will # be shared DB connections in child processes which may cause # DB errors. - session.dispose() + session.context_manager.dispose_pool() for worker in process_workers: worker_launcher.launch_service(worker, diff --git a/neutron/wsgi.py b/neutron/wsgi.py index 51d5cc1d18b..9464fa548a2 100644 --- a/neutron/wsgi.py +++ b/neutron/wsgi.py @@ -188,7 +188,7 @@ class Server(object): # dispose the whole pool before os.fork, otherwise there will # be shared DB connections in child processes which may cause # DB errors. - api.dispose() + api.context_manager.dispose_pool() # The API service runs in a number of child processes. # Minimize the cost of checking for child exit by extending the # wait interval past the default of 0.01s.