config options: Centralise floating ip options

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

Change-Id: Ie7b491e668031fb8f54d27b0bab357b5f2ee3e3d
Implements: blueprint centralize-config-options-newton
This commit is contained in:
Kevin_Zheng 2015-12-14 09:55:16 +08:00
parent c4763d46fe
commit f8916b4b45
4 changed files with 59 additions and 24 deletions

View File

@ -39,7 +39,7 @@ from nova.conf import conductor
# from nova.conf import database
# from nova.conf import disk
from nova.conf import ephemeral_storage
# from nova.conf import floating_ip
from nova.conf import floating_ips
# from nova.conf import glance
# from nova.conf import guestfs
# from nova.conf import host
@ -99,7 +99,7 @@ conductor.register_opts(CONF)
# database.register_opts(CONF)
# disk.register_opts(CONF)
ephemeral_storage.register_opts(CONF)
# floating_ip.register_opts(CONF)
floating_ips.register_opts(CONF)
# glance.register_opts(CONF)
# guestfs.register_opts(CONF)
# host.register_opts(CONF)

55
nova/conf/floating_ips.py Normal file
View File

@ -0,0 +1,55 @@
# Copyright 2016 Huawei Technology corp.
# 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
default_floating_pool_opt = cfg.StrOpt('default_floating_pool',
default='nova',
help='Default pool for floating IPs')
auto_assign_opt = cfg.BoolOpt('auto_assign_floating_ip',
default=False,
help='Autoassigning floating IP to VM')
dns_mgr_opt = cfg.StrOpt('floating_ip_dns_manager',
default='nova.network.noop_dns_driver.NoopDNSDriver',
help='Full class name for the DNS Manager for '
'floating IPs')
instance_dns_opt = cfg.StrOpt('instance_dns_manager',
default='nova.network.noop_dns_driver.NoopDNSDriver',
help='Full class name for the DNS Manager for '
'instance IPs')
dns_domain_opt = cfg.StrOpt('instance_dns_domain',
default='',
help='Full class name for the DNS Zone '
'for instance IPs')
ALL_OPTS = [
default_floating_pool_opt,
auto_assign_opt,
dns_domain_opt,
dns_mgr_opt,
instance_dns_opt
]
def register_opts(conf):
conf.register_opts(ALL_OPTS)
def list_opts():
return {'DEFAULT': ALL_OPTS}

View File

@ -16,7 +16,6 @@
# under the License.
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_utils import excutils
@ -24,6 +23,7 @@ from oslo_utils import importutils
from oslo_utils import uuidutils
import six
import nova.conf
from nova import context
from nova.db import base
from nova import exception
@ -39,26 +39,7 @@ LOG = logging.getLogger(__name__)
QUOTAS = quota.QUOTAS
floating_opts = [
cfg.StrOpt('default_floating_pool',
default='nova',
help='Default pool for floating IPs'),
cfg.BoolOpt('auto_assign_floating_ip',
default=False,
help='Autoassigning floating IP to VM'),
cfg.StrOpt('floating_ip_dns_manager',
default='nova.network.noop_dns_driver.NoopDNSDriver',
help='Full class name for the DNS Manager for floating IPs'),
cfg.StrOpt('instance_dns_manager',
default='nova.network.noop_dns_driver.NoopDNSDriver',
help='Full class name for the DNS Manager for instance IPs'),
cfg.StrOpt('instance_dns_domain',
default='',
help='Full class name for the DNS Zone for instance IPs'),
]
CONF = cfg.CONF
CONF.register_opts(floating_opts)
CONF = nova.conf.CONF
CONF.import_opt('public_interface', 'nova.network.linux_net')
CONF.import_opt('network_topic', 'nova.network.rpcapi')

View File

@ -29,7 +29,6 @@ def list_opts():
itertools.chain(
nova.network._network_opts,
nova.network.driver.driver_opts,
nova.network.floating_ips.floating_opts,
nova.network.ldapdns.ldap_dns_opts,
nova.network.linux_net.linux_net_opts,
nova.network.manager.network_opts,