From a3e9530fe96114eb0facf535e868c534498bae18 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 ++++----------- nova/manager.py | 4 ++-- ...-db_driver-config-opt-50110843b3221fc4.yaml | 7 +++++++ 4 files changed, 16 insertions(+), 28 deletions(-) create mode 100644 releasenotes/notes/remove-db_driver-config-opt-50110843b3221fc4.yaml diff --git a/nova/conf/database.py b/nova/conf/database.py index c3d1a0242ad7..ada7a3637332 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 5f79fb5b10c7..c52ad385f454 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 diff --git a/nova/manager.py b/nova/manager.py index c73d18fbad16..32e2ef49438f 100644 --- a/nova/manager.py +++ b/nova/manager.py @@ -91,7 +91,7 @@ class ManagerMeta(profiler.get_traced_meta(), type(PeriodicTasks)): class Manager(base.Base, PeriodicTasks): __trace_args__ = {"name": "rpc"} - def __init__(self, host=None, db_driver=None, service_name='undefined'): + def __init__(self, host=None, service_name='undefined'): if not host: host = CONF.host self.host = host @@ -99,7 +99,7 @@ class Manager(base.Base, PeriodicTasks): self.service_name = service_name self.notifier = rpc.get_notifier(self.service_name, self.host) self.additional_endpoints = [] - super(Manager, self).__init__(db_driver) + super(Manager, self).__init__() def periodic_tasks(self, context, raise_on_error=False): """Tasks to be run at a periodic interval.""" diff --git a/releasenotes/notes/remove-db_driver-config-opt-50110843b3221fc4.yaml b/releasenotes/notes/remove-db_driver-config-opt-50110843b3221fc4.yaml new file mode 100644 index 000000000000..9867ed3a3b6e --- /dev/null +++ b/releasenotes/notes/remove-db_driver-config-opt-50110843b3221fc4.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - | + The ``db_driver`` configuration option was deprecated in a previous release + and has now been removed. This option allowed you to replace the SQLAlchemy + database layer with one of your own. The approach was deprecated and + unsupported, and it is now time to remove it completely.