Merge "conf: Remove 'db_driver' config opt"

This commit is contained in:
Zuul 2018-04-09 11:46:45 +00:00 committed by Gerrit Code Review
commit f70aa6103c
2 changed files with 7 additions and 26 deletions

View File

@ -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
}

View File

@ -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