Centralize config options - [dhcp]

Nova style refactor of config options in Ironic.

Change-Id: Ie801d2f2c1fe6b52e99a491b88f45e658f15ef1c
Partial-Bug: #1561100
This commit is contained in:
Ramamani Yeleswarapu 2016-04-05 10:08:18 -07:00
parent f38565e751
commit 522fa1c93e
4 changed files with 33 additions and 14 deletions

View File

@ -13,21 +13,10 @@
# under the License.
from oslo_concurrency import lockutils
from oslo_config import cfg
import stevedore
from ironic.common import exception
from ironic.common.i18n import _
dhcp_provider_opts = [
cfg.StrOpt('dhcp_provider',
default='neutron',
help=_('DHCP provider to use. "neutron" uses Neutron, and '
'"none" uses a no-op provider.')),
]
CONF = cfg.CONF
CONF.register_opts(dhcp_provider_opts, group='dhcp')
from ironic.conf import CONF
_dhcp_provider = None

View File

@ -20,6 +20,7 @@ from ironic.conf import cisco_ucs
from ironic.conf import conductor
from ironic.conf import console
from ironic.conf import database
from ironic.conf import dhcp
CONF = cfg.CONF
@ -28,3 +29,4 @@ cisco_ucs.register_opts(CONF)
conductor.register_opts(CONF)
console.register_opts(CONF)
database.register_opts(CONF)
dhcp.register_opts(CONF)

29
ironic/conf/dhcp.py Normal file
View File

@ -0,0 +1,29 @@
# Copyright 2016 Intel Corporation
# Copyright 2014 Rackspace, Inc.
#
# 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
from ironic.common.i18n import _
opts = [
cfg.StrOpt('dhcp_provider',
default='neutron',
help=_('DHCP provider to use. "neutron" uses Neutron, and '
'"none" uses a no-op provider.')),
]
def register_opts(conf):
conf.register_opts(opts, group='dhcp')

View File

@ -14,7 +14,6 @@ import itertools
import ironic.api
import ironic.api.app
import ironic.common.dhcp_factory
import ironic.common.driver_factory
import ironic.common.exception
import ironic.common.glance_service.v2.image_service
@ -81,7 +80,7 @@ _opts = [
('console', ironic.conf.console.opts),
('database', ironic.conf.database.opts),
('deploy', ironic.drivers.modules.deploy_utils.deploy_opts),
('dhcp', ironic.common.dhcp_factory.dhcp_provider_opts),
('dhcp', ironic.conf.dhcp.opts),
('glance', itertools.chain(
ironic.common.glance_service.v2.image_service.glance_opts,
ironic.common.image_service.glance_opts)),