From 32b510aaa040f91fa03095db6e3ba3b3178be4ce Mon Sep 17 00:00:00 2001 From: Toan Nguyen Date: Mon, 25 Jan 2016 10:21:49 -0500 Subject: [PATCH] centralized conf: nova/network/rpcapi.py Moving the config options, used in nova/network/rpcapi.py for nova network, to the new central location "nova/conf/network.py". Implements: blueprint centralize-config-options-newton Change-Id: I62f019632e72359711430ad2f017911337f2e30b --- nova/conf/network.py | 13 ++++++++++++- nova/network/opts.py | 26 -------------------------- nova/network/rpcapi.py | 11 ----------- setup.cfg | 1 - 4 files changed, 12 insertions(+), 39 deletions(-) delete mode 100644 nova/network/opts.py diff --git a/nova/conf/network.py b/nova/conf/network.py index b9ec54dd2976..922844cadb1c 100644 --- a/nova/conf/network.py +++ b/nova/conf/network.py @@ -670,8 +670,18 @@ driver_opts = [ help='Driver to use for network creation'), ] +rpcapi_opts = [ + cfg.StrOpt('network_topic', + default='network', + help='The topic network nodes listen on'), + cfg.BoolOpt('multi_host', + default=False, + help='Default value for multi_host in networks. Also, if set, ' + 'some rpc network calls will be sent directly to host.'), +] + ALL_DEFAULT_OPTS = (linux_net_opts + network_opts + ldap_dns_opts - + security_group_opts + driver_opts) + + security_group_opts + rpcapi_opts + driver_opts) def register_opts(conf): @@ -680,6 +690,7 @@ def register_opts(conf): conf.register_opts(ldap_dns_opts) conf.register_opts(security_group_opts) conf.register_opts(driver_opts) + conf.register_opts(rpcapi_opts) def list_opts(): diff --git a/nova/network/opts.py b/nova/network/opts.py deleted file mode 100644 index 597014a1cb22..000000000000 --- a/nova/network/opts.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -import itertools - -import nova.network -import nova.network.floating_ips -import nova.network.rpcapi - - -def list_opts(): - return [ - ('DEFAULT', - itertools.chain( - nova.network.rpcapi.rpcapi_opts, - )) - ] diff --git a/nova/network/rpcapi.py b/nova/network/rpcapi.py index 9bd24050dbc3..986554cb9061 100644 --- a/nova/network/rpcapi.py +++ b/nova/network/rpcapi.py @@ -16,7 +16,6 @@ Client side of the network RPC API. """ -from oslo_config import cfg import oslo_messaging as messaging from oslo_serialization import jsonutils @@ -24,18 +23,8 @@ import nova.conf from nova.objects import base as objects_base from nova import rpc -rpcapi_opts = [ - cfg.StrOpt('network_topic', - default='network', - help='The topic network nodes listen on'), - cfg.BoolOpt('multi_host', - default=False, - help='Default value for multi_host in networks. Also, if set, ' - 'some rpc network calls will be sent directly to host.'), -] CONF = nova.conf.CONF -CONF.register_opts(rpcapi_opts) class NetworkAPI(object): diff --git a/setup.cfg b/setup.cfg index 5304381c2aa5..31c109d7ba29 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,6 @@ oslo.config.opts = nova.api = nova.api.opts:list_opts nova.cells = nova.cells.opts:list_opts nova.compute = nova.compute.opts:list_opts - nova.network = nova.network.opts:list_opts nova.network.neutronv2 = nova.network.neutronv2.api:list_opts nova.virt = nova.virt.opts:list_opts nova.cache_utils = nova.cache_utils:list_opts