From e845e0439571d7c478a7c8ea5f30882d889c19e3 Mon Sep 17 00:00:00 2001 From: Hieu LE Date: Fri, 8 Apr 2016 11:38:29 +0700 Subject: [PATCH] Config options: centralize section "xvp" The config options of the "nova.conf" section "xvp" now moved to the new central location "nova/conf/xvp.py". Change-Id: I0e93f977e7d4e61fbe482622aa1834d78e2c0b2b Implements: blueprint centralize-config-options-newton --- nova/conf/__init__.py | 4 +-- nova/conf/xvp.py | 58 +++++++++++++++++++++++++++++++++++++++++++ nova/console/xvp.py | 26 ++----------------- nova/opts.py | 2 -- 4 files changed, 62 insertions(+), 28 deletions(-) create mode 100644 nova/conf/xvp.py diff --git a/nova/conf/__init__.py b/nova/conf/__init__.py index 8b3ec00532..ec5beba37f 100644 --- a/nova/conf/__init__.py +++ b/nova/conf/__init__.py @@ -82,7 +82,7 @@ from nova.conf import vnc from nova.conf import workarounds from nova.conf import wsgi from nova.conf import xenserver -# from nova.conf import xvp +from nova.conf import xvp # from nova.conf import zookeeper CONF = cfg.CONF @@ -149,7 +149,7 @@ vnc.register_opts(CONF) workarounds.register_opts(CONF) wsgi.register_opts(CONF) xenserver.register_opts(CONF) -# xvp.register_opts(CONF) +xvp.register_opts(CONF) # zookeeper.register_opts(CONF) remote_debug.register_cli_opts(CONF) diff --git a/nova/conf/xvp.py b/nova/conf/xvp.py new file mode 100644 index 0000000000..e90d97796f --- /dev/null +++ b/nova/conf/xvp.py @@ -0,0 +1,58 @@ +# Copyright 2016 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 nova import paths + +from oslo_config import cfg + +xvp_group = cfg.OptGroup( + 'xvp', + title='XVP options') + +xvp_opts = [ + cfg.StrOpt('console_xvp_conf_template', + default=paths.basedir_def('nova/console/xvp.conf.template'), + deprecated_group='DEFAULT', + help='XVP conf template'), + cfg.StrOpt('console_xvp_conf', + default='/etc/xvp.conf', + deprecated_group='DEFAULT', + help='Generated XVP conf file'), + cfg.StrOpt('console_xvp_pid', + default='/var/run/xvp.pid', + deprecated_group='DEFAULT', + help='XVP master process pid file'), + cfg.StrOpt('console_xvp_log', + default='/var/log/xvp.log', + deprecated_group='DEFAULT', + help='XVP log file'), + cfg.IntOpt('console_xvp_multiplex_port', + default=5900, + deprecated_group='DEFAULT', + min=1, + max=65535, + help='Port for XVP to multiplex VNC connections on'), + ] + + +def register_opts(conf): + conf.register_group(xvp_group) + conf.register_opts(xvp_opts, group=xvp_group) + + +def list_opts(): + return { + xvp_group: xvp_opts + } diff --git a/nova/console/xvp.py b/nova/console/xvp.py index 46e9853781..ec3b8f34cf 100644 --- a/nova/console/xvp.py +++ b/nova/console/xvp.py @@ -20,39 +20,17 @@ import signal import jinja2 from oslo_concurrency import processutils -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import excutils +import nova.conf from nova import context from nova import db from nova.i18n import _, _LE -from nova import paths from nova import utils -xvp_opts = [ - cfg.StrOpt('console_xvp_conf_template', - default=paths.basedir_def('nova/console/xvp.conf.template'), - help='XVP conf template'), - cfg.StrOpt('console_xvp_conf', - default='/etc/xvp.conf', - help='Generated XVP conf file'), - cfg.StrOpt('console_xvp_pid', - default='/var/run/xvp.pid', - help='XVP master process pid file'), - cfg.StrOpt('console_xvp_log', - default='/var/log/xvp.log', - help='XVP log file'), - cfg.IntOpt('console_xvp_multiplex_port', - default=5900, - min=1, - max=65535, - help='Port for XVP to multiplex VNC connections on'), - ] - -CONF = cfg.CONF -CONF.register_opts(xvp_opts) +CONF = nova.conf.CONF CONF.import_opt('host', 'nova.netconf') LOG = logging.getLogger(__name__) diff --git a/nova/opts.py b/nova/opts.py index 7bef46e412..9892fe6335 100644 --- a/nova/opts.py +++ b/nova/opts.py @@ -21,7 +21,6 @@ import nova.conductor.tasks.live_migrate import nova.conf import nova.console.rpcapi import nova.console.serial -import nova.console.xvp import nova.consoleauth.rpcapi import nova.db.api import nova.db.base @@ -43,7 +42,6 @@ def list_opts(): [nova.conductor.tasks.live_migrate.migrate_opt], [nova.db.base.db_driver_opt], [nova.servicegroup.api.servicegroup_driver_opt], - nova.console.xvp.xvp_opts, nova.db.api.db_opts, nova.db.sqlalchemy.api.db_opts, nova.exception.exc_log_opts,