diff --git a/ironic/common/neutron.py b/ironic/common/neutron.py index 780d4d1113..b79e96d3f5 100644 --- a/ironic/common/neutron.py +++ b/ironic/common/neutron.py @@ -12,7 +12,6 @@ from neutronclient.common import exceptions as neutron_exceptions from neutronclient.v2_0 import client as clientv20 -from oslo_config import cfg from oslo_log import log 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 _LW from ironic.common import keystone +from ironic.conf import CONF 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): params = { diff --git a/ironic/conf/__init__.py b/ironic/conf/__init__.py index baff22891d..aaccf49338 100644 --- a/ironic/conf/__init__.py +++ b/ironic/conf/__init__.py @@ -28,6 +28,7 @@ from ironic.conf import inspector from ironic.conf import ipmi from ironic.conf import irmc from ironic.conf import keystone +from ironic.conf import neutron from ironic.conf import oneview from ironic.conf import seamicro from ironic.conf import snmp @@ -50,6 +51,7 @@ inspector.register_opts(CONF) ipmi.register_opts(CONF) irmc.register_opts(CONF) keystone.register_opts(CONF) +neutron.register_opts(CONF) oneview.register_opts(CONF) seamicro.register_opts(CONF) snmp.register_opts(CONF) diff --git a/ironic/conf/neutron.py b/ironic/conf/neutron.py new file mode 100644 index 0000000000..03869d5945 --- /dev/null +++ b/ironic/conf/neutron.py @@ -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') diff --git a/ironic/conf/opts.py b/ironic/conf/opts.py index 604db652b5..5043cb0070 100644 --- a/ironic/conf/opts.py +++ b/ironic/conf/opts.py @@ -71,7 +71,7 @@ _opts = [ ('irmc', ironic.conf.irmc.opts), ('iscsi', ironic.drivers.modules.iscsi_deploy.iscsi_opts), ('keystone', ironic.conf.keystone.opts), - ('neutron', ironic.common.neutron.neutron_opts), + ('neutron', ironic.conf.neutron.opts), ('oneview', ironic.conf.oneview.opts), ('pxe', itertools.chain( ironic.drivers.modules.iscsi_deploy.pxe_opts, diff --git a/ironic/dhcp/neutron.py b/ironic/dhcp/neutron.py index a5027e05f6..b412ae7d97 100644 --- a/ironic/dhcp/neutron.py +++ b/ironic/dhcp/neutron.py @@ -17,7 +17,6 @@ import time from neutronclient.common import exceptions as neutron_client_exc -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import netutils @@ -27,11 +26,11 @@ from ironic.common.i18n import _LE from ironic.common.i18n import _LW from ironic.common import network from ironic.common import neutron +from ironic.conf import CONF from ironic.dhcp import base from ironic.drivers.modules import ssh from ironic import objects -CONF = cfg.CONF LOG = logging.getLogger(__name__) create_cleaning_ports_deprecation = False