From fe34313ddebaa720f2d1361eb0a5979d925f23d4 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 29 Sep 2017 11:56:13 +0100 Subject: [PATCH] conf: Remove 'db_driver' config opt This option has been deprecated for a long time and any kinks, where they existed, should have long since been worked out. Time to kill it. Change-Id: Ifa686b5ce5e8063a8e5f2f22c89124c1d4083b80 --- nova/conf/database.py | 18 +++--------------- nova/db/base.py | 15 ++++----------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/nova/conf/database.py b/nova/conf/database.py index c3d1a0242..ada7a3637 100644 --- a/nova/conf/database.py +++ b/nova/conf/database.py @@ -21,17 +21,6 @@ from nova.conf import paths _DEFAULT_SQL_CONNECTION = 'sqlite:///' + paths.state_path_def('nova.sqlite') -# NOTE(sdague): we know of at least 1 instance of out of tree usage -# for this config in RAX. They used this because of performance issues -# with some queries. We think the right path forward is fixing the -# SQLA queries to be more performant for everyone. -db_driver_opt = cfg.StrOpt('db_driver', - default='nova.db', - deprecated_for_removal=True, - deprecated_since='13.0.0', - help='The driver to use for database access') - - # NOTE(markus_z): We cannot simply do: # conf.register_opts(oslo_db_options.database_opts, 'api_database') # If we reuse a db config option for two different groups ("api_database" @@ -115,7 +104,6 @@ def enrich_help_text(alt_db_opts): def register_opts(conf): oslo_db_options.set_defaults(conf, connection=_DEFAULT_SQL_CONNECTION) - conf.register_opt(db_driver_opt) conf.register_opts(api_db_opts, group=api_db_group) @@ -128,6 +116,6 @@ def list_opts(): # in the "sample.conf" file, I omit the listing of the "oslo_db_options" # here. enrich_help_text(api_db_opts) - return {'DEFAULT': [db_driver_opt], - api_db_group: api_db_opts, - } + return { + api_db_group: api_db_opts + } diff --git a/nova/db/base.py b/nova/db/base.py index 5f79fb5b1..c52ad385f 100644 --- a/nova/db/base.py +++ b/nova/db/base.py @@ -14,21 +14,14 @@ # License for the specific language governing permissions and limitations # under the License. -"""Base class for classes that need modular database access.""" +"""Base class for classes that need database access.""" -from oslo_utils import importutils - -import nova.conf - - -CONF = nova.conf.CONF +import nova.db class Base(object): """DB driver is injected in the init method.""" - def __init__(self, db_driver=None): + def __init__(self): super(Base, self).__init__() - if not db_driver: - db_driver = CONF.db_driver - self.db = importutils.import_module(db_driver) + self.db = nova.db