Config options: move set default opt of db section to centralized place

Currently markus_z have centralized database section in
nova/conf/database.py. But in nova/config.py, there is a
part of database section that set the default options of
oslo_db. The set_default_opt include register_opt and should be
moved to centralized place.

Change-Id: Ic94991b009dfaa076a5f285b43018e473e9e074f
Implements: blueprint centralize-config-options-newton
This commit is contained in:
Hieu LE 2016-05-18 12:54:17 +07:00
parent cdfbb9a668
commit f86a3a4e01
3 changed files with 5 additions and 8 deletions

View File

@ -89,7 +89,6 @@ from nova import utils
from nova import version
CONF = nova.conf.CONF
CONF.import_opt('connection', 'oslo_db.options', group='database')
QUOTAS = quota.QUOTAS

View File

@ -13,10 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.conf import paths
from oslo_config import cfg
from oslo_db import options as oslo_db_options
_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
@ -87,7 +90,8 @@ api_db_opts = [
def register_opts(conf):
conf.register_opts(oslo_db_options.database_opts, 'database')
oslo_db_options.set_defaults(conf, connection=_DEFAULT_SQL_CONNECTION,
sqlite_db='nova.sqlite')
conf.register_opt(db_driver_opt)
conf.register_opts(api_db_opts, group='api_database')

View File

@ -15,12 +15,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_db import options
from oslo_log import log
from nova.common import config
import nova.conf
from nova.conf import paths
from nova.db.sqlalchemy import api as sqlalchemy_api
from nova import rpc
from nova import version
@ -28,8 +26,6 @@ from nova import version
CONF = nova.conf.CONF
_DEFAULT_SQL_CONNECTION = 'sqlite:///' + paths.state_path_def('nova.sqlite')
_EXTRA_DEFAULT_LOG_LEVELS = ['glanceclient=WARN']
@ -40,8 +36,6 @@ def parse_args(argv, default_config_files=None, configure_db=True,
# and add only the extra levels that Nova needs
log.set_defaults(default_log_levels=log.get_default_log_levels() +
_EXTRA_DEFAULT_LOG_LEVELS)
options.set_defaults(CONF, connection=_DEFAULT_SQL_CONNECTION,
sqlite_db='nova.sqlite')
rpc.set_defaults(control_exchange='nova')
config.set_middleware_defaults()