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
This commit is contained in:
Salvatore Orlando 2013-08-05 08:51:16 -07:00
parent eb2168c907
commit 09e5d2e572
2 changed files with 2 additions and 10 deletions

View File

@ -25,7 +25,6 @@ from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
_DB_ENGINE = None
BASE = model_base.BASEV2 BASE = model_base.BASEV2
@ -35,17 +34,13 @@ def configure_db():
Establish the database, create an engine if needed, and register Establish the database, create an engine if needed, and register
the models. the models.
""" """
global _DB_ENGINE session.get_engine(sqlite_fk=True)
if not _DB_ENGINE: register_models()
_DB_ENGINE = session.get_engine(sqlite_fk=True)
register_models()
def clear_db(base=BASE): def clear_db(base=BASE):
global _DB_ENGINE
unregister_models(base) unregister_models(base)
session.cleanup() session.cleanup()
_DB_ENGINE = None
def get_session(autocommit=True, expire_on_commit=False): def get_session(autocommit=True, expire_on_commit=False):

View File

@ -73,8 +73,6 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
in cfg.CONF.META.plugin_list.split(',')] in cfg.CONF.META.plugin_list.split(',')]
for flavor, plugin_provider in plugin_list: for flavor, plugin_provider in plugin_list:
self.plugins[flavor] = self._load_plugin(plugin_provider) self.plugins[flavor] = self._load_plugin(plugin_provider)
# Needed to clear _DB_ENGINE for each plugin
db._DB_ENGINE = None
self.l3_plugins = {} self.l3_plugins = {}
l3_plugin_list = [plugin_set.split(':') l3_plugin_list = [plugin_set.split(':')
@ -86,7 +84,6 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
else: else:
# For l3 only plugin # For l3 only plugin
self.l3_plugins[flavor] = self._load_plugin(plugin_provider) self.l3_plugins[flavor] = self._load_plugin(plugin_provider)
db._DB_ENGINE = None
self.default_flavor = cfg.CONF.META.default_flavor self.default_flavor = cfg.CONF.META.default_flavor
if self.default_flavor not in self.plugins: if self.default_flavor not in self.plugins: