diff --git a/nova/cmd/consoleauth.py b/nova/cmd/consoleauth.py index ecfd44dcd1eb..624f27caa400 100644 --- a/nova/cmd/consoleauth.py +++ b/nova/cmd/consoleauth.py @@ -17,18 +17,16 @@ import sys -from oslo_config import cfg from oslo_log import log as logging from oslo_reports import guru_meditation_report as gmr +import nova.conf from nova import config from nova import objects from nova import service from nova import version -CONF = cfg.CONF - -CONF.import_opt('consoleauth_topic', 'nova.consoleauth') +CONF = nova.conf.CONF def main(): diff --git a/nova/conf/__init__.py b/nova/conf/__init__.py index 3b66a39651a9..bae2c378fcb1 100644 --- a/nova/conf/__init__.py +++ b/nova/conf/__init__.py @@ -33,6 +33,7 @@ from nova.conf import compute from nova.conf import conductor # from nova.conf import configdrive # from nova.conf import console +from nova.conf import consoleauth # from nova.conf import cors # from nova.conf import cors.subdomain # from nova.conf import crypto @@ -93,6 +94,7 @@ compute.register_opts(CONF) conductor.register_opts(CONF) # configdrive.register_opts(CONF) # console.register_opts(CONF) +consoleauth.register_opts(CONF) # cors.register_opts(CONF) # cors.subdomain.register_opts(CONF) # crypto.register_opts(CONF) diff --git a/nova/conf/consoleauth.py b/nova/conf/consoleauth.py new file mode 100644 index 000000000000..f156b25b0cbc --- /dev/null +++ b/nova/conf/consoleauth.py @@ -0,0 +1,36 @@ +# 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 + + +consoleauth_topic_opt = cfg.StrOpt('consoleauth_topic', + default='consoleauth', + help='The topic console auth proxy nodes listen on') + +console_token_ttl = cfg.IntOpt('console_token_ttl', + default=600, + help='How many seconds before deleting tokens') + +CONSOLEAUTH_OPTS = [consoleauth_topic_opt, console_token_ttl] + + +def register_opts(conf): + conf.register_opts(CONSOLEAUTH_OPTS) + + +def list_opts(): + return {'DEFAULT': CONSOLEAUTH_OPTS} diff --git a/nova/consoleauth/__init__.py b/nova/consoleauth/__init__.py index e770d6700db6..c2f4ca5b73ea 100644 --- a/nova/consoleauth/__init__.py +++ b/nova/consoleauth/__init__.py @@ -15,13 +15,3 @@ # limitations under the License. """Module to authenticate Consoles.""" - -from oslo_config import cfg - - -consoleauth_topic_opt = cfg.StrOpt('consoleauth_topic', - default='consoleauth', - help='The topic console auth proxy nodes listen on') - -CONF = cfg.CONF -CONF.register_opt(consoleauth_topic_opt) diff --git a/nova/consoleauth/manager.py b/nova/consoleauth/manager.py index 31add59ecf70..e34d396af4e2 100644 --- a/nova/consoleauth/manager.py +++ b/nova/consoleauth/manager.py @@ -18,7 +18,6 @@ import time -from oslo_config import cfg from oslo_log import log as logging import oslo_messaging as messaging from oslo_serialization import jsonutils @@ -34,14 +33,7 @@ from nova import objects LOG = logging.getLogger(__name__) -consoleauth_opts = [ - cfg.IntOpt('console_token_ttl', - default=600, - help='How many seconds before deleting tokens') - ] - CONF = nova.conf.CONF -CONF.register_opts(consoleauth_opts) class ConsoleAuthManager(manager.Manager): diff --git a/nova/opts.py b/nova/opts.py index e17e7ef1b312..c56da6b359d1 100644 --- a/nova/opts.py +++ b/nova/opts.py @@ -24,8 +24,6 @@ import nova.console.manager import nova.console.rpcapi import nova.console.serial import nova.console.xvp -import nova.consoleauth -import nova.consoleauth.manager import nova.consoleauth.rpcapi import nova.crypto import nova.db.api @@ -57,7 +55,6 @@ def list_opts(): ('DEFAULT', itertools.chain( [nova.conductor.tasks.live_migrate.migrate_opt], - [nova.consoleauth.consoleauth_topic_opt], [nova.db.base.db_driver_opt], [nova.ipv6.api.ipv6_backend_opt], [nova.servicegroup.api.servicegroup_driver_opt], @@ -66,7 +63,6 @@ def list_opts(): nova.console.manager.console_manager_opts, nova.console.rpcapi.rpcapi_opts, nova.console.xvp.xvp_opts, - nova.consoleauth.manager.consoleauth_opts, nova.crypto.crypto_opts, nova.db.api.db_opts, nova.db.sqlalchemy.api.db_opts,