Config options: Centralize debugger options

The config options of the "nova/debugger" got
moved to the new central location
"nova/conf/remote_debug.py"

Implements: blueprint centralize-config-options-newton

Change-Id: Ic0c858aac92c95dc20992c06218f9823e7e683e5
This commit is contained in:
Pushkar Umaranikar
2016-01-30 00:44:12 +00:00
parent ce018eccea
commit 888be36d69
4 changed files with 54 additions and 31 deletions

View File

@ -60,6 +60,7 @@ from nova.conf import network
# from nova.conf import osapi_v21
from nova.conf import pci
from nova.conf import rdp
from nova.conf import remote_debug
from nova.conf import scheduler
# from nova.conf import security
from nova.conf import serial_console
@ -136,3 +137,5 @@ wsgi.register_opts(CONF)
xenserver.register_opts(CONF)
# xvp.register_opts(CONF)
# zookeeper.register_opts(CONF)
remote_debug.register_cli_opts(CONF)

46
nova/conf/remote_debug.py Normal file
View File

@ -0,0 +1,46 @@
# Copyright (c) 2016 Intel, Inc.
# Copyright (c) 2013 OpenStack Foundation
# 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.
from oslo_config import cfg
debugger_group = cfg.OptGroup('remote_debug',
title='debugger options')
host = cfg.StrOpt('host',
help='Debug host (IP or name) to connect. Note '
'that using the remote debug option changes how '
'Nova uses the eventlet library to support async IO. '
'This could result in failures that do not occur '
'under normal operation. Use at your own risk.')
port = cfg.IntOpt('port',
min=1,
max=65535,
help='Debug port to connect. Note '
'that using the remote debug option changes how '
'Nova uses the eventlet library to support async IO. '
'This could result in failures that do not occur '
'under normal operation. Use at your own risk.')
CLI_OPTS = [host, port]
def register_cli_opts(conf):
conf.register_cli_opts(CLI_OPTS, group=debugger_group)
def list_opts():
return {debugger_group: CLI_OPTS}

View File

@ -16,18 +16,18 @@
# under the License.
from oslo_cache import core as cache
from oslo_config import cfg
from oslo_db import options
from oslo_log import log
from nova.common import config
import nova.conf
from nova.db.sqlalchemy import api as sqlalchemy_api
from nova import debugger
from nova import paths
from nova import rpc
from nova import version
CONF = cfg.CONF
CONF = nova.conf.CONF
_DEFAULT_SQL_CONNECTION = 'sqlite:///' + paths.state_path_def('nova.sqlite')
@ -45,7 +45,6 @@ def parse_args(argv, default_config_files=None, configure_db=True,
sqlite_db='nova.sqlite')
rpc.set_defaults(control_exchange='nova')
cache.configure(CONF)
debugger.register_cli_opts()
config.set_middleware_defaults()
CONF(argv[1:],

View File

@ -26,34 +26,9 @@ def enabled():
'--remote_debug-port' in sys.argv)
def register_cli_opts():
from oslo_config import cfg
cli_opts = [
cfg.StrOpt('host',
help='Debug host (IP or name) to connect. Note '
'that using the remote debug option changes how '
'Nova uses the eventlet library to support async IO. '
'This could result in failures that do not occur '
'under normal operation. Use at your own risk.'),
cfg.IntOpt('port',
min=1,
max=65535,
help='Debug port to connect. Note '
'that using the remote debug option changes how '
'Nova uses the eventlet library to support async IO. '
'This could result in failures that do not occur '
'under normal operation. Use at your own risk.')
]
cfg.CONF.register_cli_opts(cli_opts, 'remote_debug')
def init():
from oslo_config import cfg
CONF = cfg.CONF
import nova.conf
CONF = nova.conf.CONF
# NOTE(markmc): gracefully handle the CLI options not being registered
if 'remote_debug' not in CONF: