From 09e5d2e572f3beac4eb4a19b04e22df87a3de1b6 Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Mon, 5 Aug 2013 08:51:16 -0700 Subject: [PATCH] Remove global DB_ENGINE from Neutron Related-Bug 1207402 This global is not used anymore as it's been replaced by a similar global variable in neutron/openstack/common/db/sqlalchemy/session.py Change-Id: Id4614069af490020d18f14011853787930076e0a --- neutron/db/api.py | 9 ++------- neutron/plugins/metaplugin/meta_neutron_plugin.py | 3 --- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/neutron/db/api.py b/neutron/db/api.py index 4f813dd735..1e05361fac 100644 --- a/neutron/db/api.py +++ b/neutron/db/api.py @@ -25,7 +25,6 @@ from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) -_DB_ENGINE = None BASE = model_base.BASEV2 @@ -35,17 +34,13 @@ def configure_db(): Establish the database, create an engine if needed, and register the models. """ - global _DB_ENGINE - if not _DB_ENGINE: - _DB_ENGINE = session.get_engine(sqlite_fk=True) - register_models() + session.get_engine(sqlite_fk=True) + register_models() def clear_db(base=BASE): - global _DB_ENGINE unregister_models(base) session.cleanup() - _DB_ENGINE = None def get_session(autocommit=True, expire_on_commit=False): diff --git a/neutron/plugins/metaplugin/meta_neutron_plugin.py b/neutron/plugins/metaplugin/meta_neutron_plugin.py index 01f4941415..f65c523451 100644 --- a/neutron/plugins/metaplugin/meta_neutron_plugin.py +++ b/neutron/plugins/metaplugin/meta_neutron_plugin.py @@ -73,8 +73,6 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, in cfg.CONF.META.plugin_list.split(',')] for flavor, plugin_provider in plugin_list: self.plugins[flavor] = self._load_plugin(plugin_provider) - # Needed to clear _DB_ENGINE for each plugin - db._DB_ENGINE = None self.l3_plugins = {} l3_plugin_list = [plugin_set.split(':') @@ -86,7 +84,6 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, else: # For l3 only plugin self.l3_plugins[flavor] = self._load_plugin(plugin_provider) - db._DB_ENGINE = None self.default_flavor = cfg.CONF.META.default_flavor if self.default_flavor not in self.plugins: