Centralize config options - [neutron]
Nova style refactor of config options in Ironic. Change-Id: I5963f08dd2d476ebf242851b6b4647916393d648 Partial-Bug: #1561100
This commit is contained in:
parent
6d846590bc
commit
af78314694
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
from neutronclient.common import exceptions as neutron_exceptions
|
from neutronclient.common import exceptions as neutron_exceptions
|
||||||
from neutronclient.v2_0 import client as clientv20
|
from neutronclient.v2_0 import client as clientv20
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
from ironic.common import exception
|
from ironic.common import exception
|
||||||
@ -21,48 +20,10 @@ from ironic.common.i18n import _LE
|
|||||||
from ironic.common.i18n import _LI
|
from ironic.common.i18n import _LI
|
||||||
from ironic.common.i18n import _LW
|
from ironic.common.i18n import _LW
|
||||||
from ironic.common import keystone
|
from ironic.common import keystone
|
||||||
|
from ironic.conf import CONF
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.import_opt('my_ip', 'ironic.netconf')
|
|
||||||
|
|
||||||
neutron_opts = [
|
|
||||||
cfg.StrOpt('url',
|
|
||||||
default='http://$my_ip:9696',
|
|
||||||
help=_('URL for connecting to neutron.')),
|
|
||||||
cfg.IntOpt('url_timeout',
|
|
||||||
default=30,
|
|
||||||
help=_('Timeout value for connecting to neutron in seconds.')),
|
|
||||||
cfg.IntOpt('port_setup_delay',
|
|
||||||
default=0,
|
|
||||||
min=0,
|
|
||||||
help=_('Delay value to wait for Neutron agents to setup '
|
|
||||||
'sufficient DHCP configuration for port.')),
|
|
||||||
cfg.IntOpt('retries',
|
|
||||||
default=3,
|
|
||||||
help=_('Client retries in the case of a failed request.')),
|
|
||||||
cfg.StrOpt('auth_strategy',
|
|
||||||
default='keystone',
|
|
||||||
choices=['keystone', 'noauth'],
|
|
||||||
help=_('Authentication strategy to use when connecting to '
|
|
||||||
'neutron. Running neutron in noauth mode (related to '
|
|
||||||
'but not affected by this setting) is insecure and '
|
|
||||||
'should only be used for testing.')),
|
|
||||||
cfg.StrOpt('cleaning_network_uuid',
|
|
||||||
help=_('Neutron network UUID for the ramdisk to be booted '
|
|
||||||
'into for cleaning nodes. Required for "neutron" '
|
|
||||||
'network interface. It is also required if cleaning '
|
|
||||||
'nodes when using "flat" network interface or "neutron" '
|
|
||||||
'DHCP provider.')),
|
|
||||||
cfg.StrOpt('provisioning_network_uuid',
|
|
||||||
help=_('Neutron network UUID for the ramdisk to be booted '
|
|
||||||
'into for provisioning nodes. Required for "neutron" '
|
|
||||||
'network interface.')),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF.register_opts(neutron_opts, group='neutron')
|
|
||||||
|
|
||||||
|
|
||||||
def get_client(token=None):
|
def get_client(token=None):
|
||||||
params = {
|
params = {
|
||||||
|
@ -28,6 +28,7 @@ from ironic.conf import inspector
|
|||||||
from ironic.conf import ipmi
|
from ironic.conf import ipmi
|
||||||
from ironic.conf import irmc
|
from ironic.conf import irmc
|
||||||
from ironic.conf import keystone
|
from ironic.conf import keystone
|
||||||
|
from ironic.conf import neutron
|
||||||
from ironic.conf import oneview
|
from ironic.conf import oneview
|
||||||
from ironic.conf import seamicro
|
from ironic.conf import seamicro
|
||||||
from ironic.conf import snmp
|
from ironic.conf import snmp
|
||||||
@ -50,6 +51,7 @@ inspector.register_opts(CONF)
|
|||||||
ipmi.register_opts(CONF)
|
ipmi.register_opts(CONF)
|
||||||
irmc.register_opts(CONF)
|
irmc.register_opts(CONF)
|
||||||
keystone.register_opts(CONF)
|
keystone.register_opts(CONF)
|
||||||
|
neutron.register_opts(CONF)
|
||||||
oneview.register_opts(CONF)
|
oneview.register_opts(CONF)
|
||||||
seamicro.register_opts(CONF)
|
seamicro.register_opts(CONF)
|
||||||
snmp.register_opts(CONF)
|
snmp.register_opts(CONF)
|
||||||
|
57
ironic/conf/neutron.py
Normal file
57
ironic/conf/neutron.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# Copyright 2016 Intel Corporation
|
||||||
|
# Copyright 2014 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
|
||||||
|
|
||||||
|
from ironic.common.i18n import _
|
||||||
|
|
||||||
|
opts = [
|
||||||
|
cfg.StrOpt('url',
|
||||||
|
default='http://$my_ip:9696',
|
||||||
|
help=_('URL for connecting to neutron.')),
|
||||||
|
cfg.IntOpt('url_timeout',
|
||||||
|
default=30,
|
||||||
|
help=_('Timeout value for connecting to neutron in seconds.')),
|
||||||
|
cfg.IntOpt('port_setup_delay',
|
||||||
|
default=0,
|
||||||
|
min=0,
|
||||||
|
help=_('Delay value to wait for Neutron agents to setup '
|
||||||
|
'sufficient DHCP configuration for port.')),
|
||||||
|
cfg.IntOpt('retries',
|
||||||
|
default=3,
|
||||||
|
help=_('Client retries in the case of a failed request.')),
|
||||||
|
cfg.StrOpt('auth_strategy',
|
||||||
|
default='keystone',
|
||||||
|
choices=['keystone', 'noauth'],
|
||||||
|
help=_('Authentication strategy to use when connecting to '
|
||||||
|
'neutron. Running neutron in noauth mode (related to '
|
||||||
|
'but not affected by this setting) is insecure and '
|
||||||
|
'should only be used for testing.')),
|
||||||
|
cfg.StrOpt('cleaning_network_uuid',
|
||||||
|
help=_('Neutron network UUID for the ramdisk to be booted '
|
||||||
|
'into for cleaning nodes. Required for "neutron" '
|
||||||
|
'network interface. It is also required if cleaning '
|
||||||
|
'nodes when using "flat" network interface or "neutron" '
|
||||||
|
'DHCP provider.')),
|
||||||
|
cfg.StrOpt('provisioning_network_uuid',
|
||||||
|
help=_('Neutron network UUID for the ramdisk to be booted '
|
||||||
|
'into for provisioning nodes. Required for "neutron" '
|
||||||
|
'network interface.')),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def register_opts(conf):
|
||||||
|
conf.register_opts(opts, group='neutron')
|
@ -71,7 +71,7 @@ _opts = [
|
|||||||
('irmc', ironic.conf.irmc.opts),
|
('irmc', ironic.conf.irmc.opts),
|
||||||
('iscsi', ironic.drivers.modules.iscsi_deploy.iscsi_opts),
|
('iscsi', ironic.drivers.modules.iscsi_deploy.iscsi_opts),
|
||||||
('keystone', ironic.conf.keystone.opts),
|
('keystone', ironic.conf.keystone.opts),
|
||||||
('neutron', ironic.common.neutron.neutron_opts),
|
('neutron', ironic.conf.neutron.opts),
|
||||||
('oneview', ironic.conf.oneview.opts),
|
('oneview', ironic.conf.oneview.opts),
|
||||||
('pxe', itertools.chain(
|
('pxe', itertools.chain(
|
||||||
ironic.drivers.modules.iscsi_deploy.pxe_opts,
|
ironic.drivers.modules.iscsi_deploy.pxe_opts,
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from neutronclient.common import exceptions as neutron_client_exc
|
from neutronclient.common import exceptions as neutron_client_exc
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import netutils
|
from oslo_utils import netutils
|
||||||
|
|
||||||
@ -27,11 +26,11 @@ from ironic.common.i18n import _LE
|
|||||||
from ironic.common.i18n import _LW
|
from ironic.common.i18n import _LW
|
||||||
from ironic.common import network
|
from ironic.common import network
|
||||||
from ironic.common import neutron
|
from ironic.common import neutron
|
||||||
|
from ironic.conf import CONF
|
||||||
from ironic.dhcp import base
|
from ironic.dhcp import base
|
||||||
from ironic.drivers.modules import ssh
|
from ironic.drivers.modules import ssh
|
||||||
from ironic import objects
|
from ironic import objects
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
create_cleaning_ports_deprecation = False
|
create_cleaning_ports_deprecation = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user