From f6989483556fe578af08a33482fb3ee7a32d1ba8 Mon Sep 17 00:00:00 2001 From: Sujitha Date: Fri, 1 Apr 2016 21:58:00 +0000 Subject: [PATCH] Config options: Centralize neutron options Move config options of nova.conf section "neutron" to a new centralized location nova/conf/neutron.py Change-Id: I940878833bcf89abbf1701846f8036ea42d2ffe2 Implements: blueprint centralize-config-options-newton --- nova/conf/__init__.py | 4 ++-- nova/conf/neutron.py | 44 +++++++++++++++++++++++++++++++++++ nova/network/neutronv2/api.py | 16 ------------- nova/network/opts.py | 4 +--- 4 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 nova/conf/neutron.py diff --git a/nova/conf/__init__.py b/nova/conf/__init__.py index 6e4a0ba6a187..b3b7e65ded93 100644 --- a/nova/conf/__init__.py +++ b/nova/conf/__init__.py @@ -57,7 +57,7 @@ from nova.conf import mks # from nova.conf import metadata # from nova.conf import metrics from nova.conf import network -# from nova.conf import neutron +from nova.conf import neutron # from nova.conf import notification # from nova.conf import osapi_v21 from nova.conf import pci @@ -122,7 +122,7 @@ keymgr.register_opts(CONF) # metadata.register_opts(CONF) # metrics.register_opts(CONF) network.register_opts(CONF) -# neutron.register_opts(CONF) +neutron.register_opts(CONF) # notification.register_opts(CONF) # osapi_v21.register_opts(CONF) pci.register_opts(CONF) diff --git a/nova/conf/neutron.py b/nova/conf/neutron.py new file mode 100644 index 000000000000..b6d4dd6790b2 --- /dev/null +++ b/nova/conf/neutron.py @@ -0,0 +1,44 @@ +# 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 oslo_config import cfg + +neutron_group = cfg.OptGroup('neutron', title='Neutron Options') + +neutron_opts = [ + cfg.StrOpt('url', + default='http://127.0.0.1:9696', + help='URL for connecting to neutron'), + cfg.StrOpt('region_name', + help='Region name for connecting to neutron in admin context'), + cfg.StrOpt('ovs_bridge', + default='br-int', + help='Default OVS bridge name to use if not specified ' + 'by Neutron'), + cfg.IntOpt('extension_sync_interval', + default=600, + help='Number of seconds before querying neutron for' + ' extensions'), +] + + +def register_opts(conf): + conf.register_group(neutron_group) + conf.register_opts(neutron_opts, group=neutron_group) + + +def list_opts(): + return {neutron_group: neutron_opts} diff --git a/nova/network/neutronv2/api.py b/nova/network/neutronv2/api.py index 833aef52c62f..4f2bd8a5c3e9 100644 --- a/nova/network/neutronv2/api.py +++ b/nova/network/neutronv2/api.py @@ -43,26 +43,10 @@ from nova.pci import request as pci_request from nova.pci import utils as pci_utils from nova.pci import whitelist as pci_whitelist -neutron_opts = [ - cfg.StrOpt('url', - default='http://127.0.0.1:9696', - help='URL for connecting to neutron'), - cfg.StrOpt('region_name', - help='Region name for connecting to neutron in admin context'), - cfg.StrOpt('ovs_bridge', - default='br-int', - help='Default OVS bridge name to use if not specified ' - 'by Neutron'), - cfg.IntOpt('extension_sync_interval', - default=600, - help='Number of seconds before querying neutron for' - ' extensions'), - ] NEUTRON_GROUP = 'neutron' CONF = nova.conf.CONF -CONF.register_opts(neutron_opts, NEUTRON_GROUP) deprecations = {'cafile': [cfg.DeprecatedOpt('ca_certificates_file', group=NEUTRON_GROUP)], diff --git a/nova/network/opts.py b/nova/network/opts.py index 435efa8d8e70..693c241638b0 100644 --- a/nova/network/opts.py +++ b/nova/network/opts.py @@ -16,7 +16,6 @@ import nova.network import nova.network.driver import nova.network.floating_ips import nova.network.linux_net -import nova.network.neutronv2.api import nova.network.rpcapi import nova.network.security_group.openstack_driver @@ -30,6 +29,5 @@ def list_opts(): nova.network.linux_net.linux_net_opts, nova.network.rpcapi.rpcapi_opts, nova.network.security_group.openstack_driver.security_group_opts, - )), - ('neutron', nova.network.neutronv2.api.neutron_opts), + )) ]