Refactoring config options for mech_sriov opts
Refactoring neutron ml2 plugin mech_sriov config opts to be in neutron/conf/plugins/ml2/drivers/mech_sriov so that all the configuration options for mech_sriov reside in a centralized location. This simplifies the process of looking up the mech_sriov config opts and provides an easy way to import. Change-Id: I64b243f91f2e637279456b3b06c2998cd89dc076 Partial-Bug: #1563069
This commit is contained in:
parent
8e27076b32
commit
78d5b240c0
|
@ -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 "
|
||||
"<physical_network>:<network_device> 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 "
|
||||
"<network_device>:<vfs_to_exclude> 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')
|
|
@ -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)
|
||||
|
|
|
@ -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 "
|
||||
"<physical_network>:<network_device> 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 "
|
||||
"<network_device>:<vfs_to_exclude> 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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue