From 83c9578fcc5d06b634d48e0e186bebd60a60322e Mon Sep 17 00:00:00 2001 From: Cedric Brandily Date: Tue, 20 Oct 2015 21:51:09 +0200 Subject: [PATCH] Remove deprecated sriov agent_required option The SR-IOV option agent_required has been deprecated in Liberty. This change removes it and from now agents are mandatory for SR-IOV mechanism in order to support extended features: QoS, port security. DocImpact Closes-Bug: #1508182 Related-Bug: #1488807 Change-Id: I4e6497da6b287531a211084a5208028c84112a83 --- devstack/lib/ml2_drivers/sriovnicswitch | 4 +-- etc/neutron/plugins/ml2/ml2_conf_sriov.ini | 6 ---- neutron/cmd/sanity_check.py | 3 +- .../mech_sriov/mech_driver/mech_driver.py | 36 ++++++------------- .../mech_driver/test_mech_sriov_nic_switch.py | 13 ------- 5 files changed, 13 insertions(+), 49 deletions(-) diff --git a/devstack/lib/ml2_drivers/sriovnicswitch b/devstack/lib/ml2_drivers/sriovnicswitch index 43e9566a911..3a12c067f90 100755 --- a/devstack/lib/ml2_drivers/sriovnicswitch +++ b/devstack/lib/ml2_drivers/sriovnicswitch @@ -1,3 +1,3 @@ function configure_ml2_sriovnicswitch { - iniset /$Q_PLUGIN_CONF_FILE ml2_sriov agent_required True -} \ No newline at end of file + : +} diff --git a/etc/neutron/plugins/ml2/ml2_conf_sriov.ini b/etc/neutron/plugins/ml2/ml2_conf_sriov.ini index a39b61e6efa..a240059aca1 100644 --- a/etc/neutron/plugins/ml2/ml2_conf_sriov.ini +++ b/etc/neutron/plugins/ml2/ml2_conf_sriov.ini @@ -6,9 +6,3 @@ # # supported_pci_vendor_devs = 15b3:1004, 8086:10ca # Example: supported_pci_vendor_devs = 15b3:1004 -# -# (BoolOpt) Requires running SRIOV neutron agent for port binding -# agent_required = True -# DEPRECATED: This option is deprecated in the Liberty release -# and will be removed in the Mitaka release. From Mitaka the agent will -# always be required. diff --git a/neutron/cmd/sanity_check.py b/neutron/cmd/sanity_check.py index 9eca181fa70..c063481f73c 100644 --- a/neutron/cmd/sanity_check.py +++ b/neutron/cmd/sanity_check.py @@ -241,6 +241,7 @@ def enable_tests_from_config(): run all necessary tests, just by passing in the appropriate configs. """ + cfg.CONF.set_override('vf_management', True) if 'vxlan' in cfg.CONF.AGENT.tunnel_types: cfg.CONF.set_override('ovs_vxlan', True) if 'geneve' in cfg.CONF.AGENT.tunnel_types: @@ -260,8 +261,6 @@ def enable_tests_from_config(): if cfg.CONF.AGENT.prevent_arp_spoofing: cfg.CONF.set_override('arp_header_match', True) cfg.CONF.set_override('icmpv6_header_match', True) - if cfg.CONF.ml2_sriov.agent_required: - cfg.CONF.set_override('vf_management', True) if not cfg.CONF.AGENT.use_helper_for_ns_read: cfg.CONF.set_override('read_netns', True) if cfg.CONF.dhcp_driver == 'neutron.agent.linux.dhcp.Dnsmasq': diff --git a/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py b/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py index 2aca1019865..f904cc655f0 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py @@ -38,13 +38,6 @@ sriov_opts = [ "vendor_id:product_id according to the PCI ID " "Repository. Default enables support for Intel " "and Mellanox SR-IOV capable NICs")), - cfg.BoolOpt('agent_required', - default=True, - help=_("SRIOV neutron agent is required for port binding. " - 'DEPRECATED: This option is deprecated in the Liberty ' - 'release and will be removed in the Mitaka release. ' - 'From Mitaka the agent will always be required.'), - deprecated_for_removal=True), ] cfg.CONF.register_opts(sriov_opts, "ml2_sriov") @@ -61,9 +54,6 @@ class SriovNicSwitchMechanismDriver(api.MechanismDriver): L2 agent is not essential for port binding; port binding is handled by VIF Driver via libvirt domain XML. L2 Agent presents in order to manage port update events. - If vendor NIC does not support updates, setting agent_required = False - will allow to use Mechanism Driver without L2 agent. - """ supported_qos_rule_types = [qos_consts.RULE_TYPE_BANDWIDTH_LIMIT] @@ -93,7 +83,6 @@ class SriovNicSwitchMechanismDriver(api.MechanismDriver): try: self.pci_vendor_info = cfg.CONF.ml2_sriov.supported_pci_vendor_devs self._check_pci_vendor_config(self.pci_vendor_info) - self.agent_required = cfg.CONF.ml2_sriov.agent_required except ValueError: LOG.exception(_LE("Failed to parse supported PCI vendor devices")) raise cfg.Error(_("Parsing supported pci_vendor_devs failed")) @@ -114,27 +103,22 @@ class SriovNicSwitchMechanismDriver(api.MechanismDriver): LOG.debug("Refusing to bind due to unsupported pci_vendor device") return - if self.agent_required: - for agent in context.host_agents(self.agent_type): - LOG.debug("Checking agent: %s", agent) - if agent['alive']: - if self.try_to_bind(context, agent): - return - else: - LOG.warning(_LW("Attempting to bind with dead agent: %s"), - agent) - else: - self.try_to_bind(context) + for agent in context.host_agents(self.agent_type): + LOG.debug("Checking agent: %s", agent) + if agent['alive']: + if self.try_to_bind(context, agent): + return + else: + LOG.warning(_LW("Attempting to bind with dead agent: %s"), + agent) - def try_to_bind(self, context, agent=None): + def try_to_bind(self, context, agent): for segment in context.segments_to_bind: if self.check_segment(segment, agent): - port_status = (constants.PORT_STATUS_ACTIVE if agent is None - else constants.PORT_STATUS_DOWN) context.set_binding(segment[api.ID], self.vif_type, self._get_vif_details(segment), - port_status) + constants.PORT_STATUS_DOWN) LOG.debug("Bound using segment: %s", segment) return True return False diff --git a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py index 15033b56e90..4f5b7d9e036 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py @@ -80,7 +80,6 @@ class SriovNicSwitchMechanismBaseTestCase(base.AgentMechanismBaseTestCase): cfg.CONF.set_override('supported_pci_vendor_devs', DEFAULT_PCI_INFO, 'ml2_sriov') - cfg.CONF.set_override('agent_required', True, 'ml2_sriov') super(SriovNicSwitchMechanismBaseTestCase, self).setUp() self.driver = mech_driver.SriovNicSwitchMechanismDriver() self.driver.initialize() @@ -225,18 +224,6 @@ class SriovSwitchMechVifDetailsTestCase(SriovNicSwitchMechanismBaseTestCase): with testtools.ExpectedException(exc.SriovUnsupportedNetworkType): self.driver._get_vif_details(segment) - def test_get_vif_details_without_agent(self): - cfg.CONF.set_override('agent_required', False, 'ml2_sriov') - self.driver = mech_driver.SriovNicSwitchMechanismDriver() - self.driver.initialize() - context = TestFakePortContext(self.AGENT_TYPE, - self.AGENTS, - self.VLAN_SEGMENTS, - portbindings.VNIC_DIRECT) - - self.driver.bind_port(context) - self.assertEqual(constants.PORT_STATUS_ACTIVE, context._bound_state) - def test_get_vif_details_with_agent(self): context = TestFakePortContext(self.AGENT_TYPE, self.AGENTS,