diff --git a/neutron/conf/plugins/ml2/drivers/mech_sriov/__init__.py b/neutron/conf/plugins/ml2/drivers/mech_sriov/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/conf/plugins/ml2/drivers/mech_sriov/agent_common.py b/neutron/conf/plugins/ml2/drivers/mech_sriov/agent_common.py new file mode 100644 index 00000000000..85b665ffad1 --- /dev/null +++ b/neutron/conf/plugins/ml2/drivers/mech_sriov/agent_common.py @@ -0,0 +1,60 @@ +# Copyright 2014 Mellanox Technologies, Ltd +# +# 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 neutron._i18n import _ + +DEFAULT_DEVICE_MAPPINGS = [] +DEFAULT_EXCLUDE_DEVICES = [] + +agent_opts = [ + cfg.IntOpt('polling_interval', default=2, + help=_("The number of seconds the agent will wait between " + "polling for local device changes.")), +] + +sriov_nic_opts = [ + cfg.ListOpt('physical_device_mappings', + default=DEFAULT_DEVICE_MAPPINGS, + help=_("Comma-separated list of " + ": tuples mapping " + "physical network names to the agent's node-specific " + "physical network device interfaces of SR-IOV physical " + "function to be used for VLAN networks. All physical " + "networks listed in network_vlan_ranges on the server " + "should have mappings to appropriate interfaces on " + "each agent. " + "DEPRECATED: This option is deprecated in the Ocata " + "release and will be removed in the Pike release."), + deprecated_for_removal=True), + cfg.ListOpt('exclude_devices', + default=DEFAULT_EXCLUDE_DEVICES, + help=_("Comma-separated list of " + ": tuples, mapping " + "network_device to the agent's node-specific list of " + "virtual functions that should not be used for virtual " + "networking. vfs_to_exclude is a semicolon-separated " + "list of virtual functions to exclude from " + "network_device. The network_device in the mapping " + "should appear in the physical_device_mappings " + "list.")), +] + + +def register_agent_sriov_nic_opts(cfg=cfg.CONF): + cfg.register_opts(agent_opts, 'AGENT') + cfg.register_opts(sriov_nic_opts, 'SRIOV_NIC') diff --git a/neutron/opts.py b/neutron/opts.py index 7d175769f31..5bcb79b4e56 100644 --- a/neutron/opts.py +++ b/neutron/opts.py @@ -37,6 +37,7 @@ import neutron.conf.plugins.ml2.drivers.agent import neutron.conf.plugins.ml2.drivers.driver_type import neutron.conf.plugins.ml2.drivers.linuxbridge import neutron.conf.plugins.ml2.drivers.macvtap +import neutron.conf.plugins.ml2.drivers.mech_sriov.agent_common import neutron.conf.quota import neutron.conf.service import neutron.conf.services.metering_agent @@ -279,7 +280,7 @@ def list_ovs_opts(): def list_sriov_agent_opts(): return [ ('sriov_nic', - neutron.plugins.ml2.drivers.mech_sriov.agent.common.config. + neutron.conf.plugins.ml2.drivers.mech_sriov.agent_common. sriov_nic_opts), ('agent', neutron.conf.agent.agent_extensions_manager.AGENT_EXT_MANAGER_OPTS) diff --git a/neutron/plugins/ml2/drivers/mech_sriov/agent/common/config.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/common/config.py index 1173d8a9aa2..10b3d17dc26 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/common/config.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/common/config.py @@ -18,6 +18,8 @@ from oslo_config import cfg from neutron._i18n import _ from neutron.agent.common import config +from neutron.conf.plugins.ml2.drivers.mech_sriov import agent_common as \ + agent_common_config def parse_exclude_devices(exclude_list): @@ -51,40 +53,6 @@ def parse_exclude_devices(exclude_list): exclude_mapping[dev_name] = exclude_devices_set return exclude_mapping -DEFAULT_DEVICE_MAPPINGS = [] -DEFAULT_EXCLUDE_DEVICES = [] -agent_opts = [ - cfg.IntOpt('polling_interval', default=2, - help=_("The number of seconds the agent will wait between " - "polling for local device changes.")), -] - -sriov_nic_opts = [ - cfg.ListOpt('physical_device_mappings', - default=DEFAULT_DEVICE_MAPPINGS, - help=_("Comma-separated list of " - ": tuples mapping " - "physical network names to the agent's node-specific " - "physical network device interfaces of SR-IOV physical " - "function to be used for VLAN networks. All physical " - "networks listed in network_vlan_ranges on the server " - "should have mappings to appropriate interfaces on " - "each agent.")), - cfg.ListOpt('exclude_devices', - default=DEFAULT_EXCLUDE_DEVICES, - help=_("Comma-separated list of " - ": tuples, mapping " - "network_device to the agent's node-specific list of " - "virtual functions that should not be used for virtual " - "networking. vfs_to_exclude is a semicolon-separated " - "list of virtual functions to exclude from " - "network_device. The network_device in the mapping " - "should appear in the physical_device_mappings " - "list.")), -] - - -cfg.CONF.register_opts(agent_opts, 'AGENT') -cfg.CONF.register_opts(sriov_nic_opts, 'SRIOV_NIC') +agent_common_config.register_agent_sriov_nic_opts() config.register_agent_state_opts_helper(cfg.CONF) diff --git a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/common/test_config.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/common/test_config.py index cca00304a47..1d2325858f7 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/common/test_config.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/common/test_config.py @@ -16,6 +16,8 @@ from neutron_lib.utils import helpers from oslo_config import cfg +from neutron.conf.plugins.ml2.drivers.mech_sriov import agent_common \ + as agent_common_config from neutron.plugins.ml2.drivers.mech_sriov.agent.common import config from neutron.plugins.ml2.drivers.mech_sriov.agent \ import sriov_nic_agent as agent @@ -49,9 +51,9 @@ class TestSriovAgentConfig(base.BaseTestCase): 'physnet3': ['p3p1']} def test_defaults(self): - self.assertEqual(config.DEFAULT_DEVICE_MAPPINGS, + self.assertEqual(agent_common_config.DEFAULT_DEVICE_MAPPINGS, cfg.CONF.SRIOV_NIC.physical_device_mappings) - self.assertEqual(config.DEFAULT_EXCLUDE_DEVICES, + self.assertEqual(agent_common_config.DEFAULT_EXCLUDE_DEVICES, cfg.CONF.SRIOV_NIC.exclude_devices) self.assertEqual(2, cfg.CONF.AGENT.polling_interval)