placement/nova/db/base.py
Markus Zoeller cad0034920 config options: centralize section "database" + "api_database"
The config options of the "nova.conf" section "database" and
"api_database" got moved to the new central location
"nova/conf/database.py". Also the database related options which are
in DEFAULT section.

Follow up changes will improve the help texts.

bp centralize-config-options-newton

Change-Id: Iaba9b49490fea4950bb25eed3ba1252db206f3c9
2016-05-16 10:20:51 +00:00

35 lines
1.1 KiB
Python

# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Base class for classes that need modular database access."""
from oslo_utils import importutils
import nova.conf
CONF = nova.conf.CONF
class Base(object):
"""DB driver is injected in the init method."""
def __init__(self, db_driver=None):
super(Base, self).__init__()
if not db_driver:
db_driver = CONF.db_driver
self.db = importutils.import_module(db_driver)