From 3488559abaaffe28b0831689288938261a458adc Mon Sep 17 00:00:00 2001 From: Moshe Levi Date: Sat, 9 May 2015 18:53:59 +0300 Subject: [PATCH] mlnx MD: mlnx_direct removal mlnx_direct is deprecated from Juno release. sriov-nic-switch with macvtap port is the replacement for it. This patch removes the mlnx_direct from mlnx MD and from the supported vif_types. Closes-Bug: #1453410 Change-Id: I7ee528dc04cdafa27455d5f8fd18c04c858466d8 --- etc/neutron/plugins/ml2/ml2_conf_mlnx.ini | 4 --- neutron/extensions/portbindings.py | 3 +- neutron/plugins/ml2/drivers/mlnx/config.py | 29 ------------------- neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py | 22 ++++++-------- .../ml2/drivers/mlnx/test_mech_mlnx.py | 13 +-------- setup.cfg | 1 - 6 files changed, 11 insertions(+), 61 deletions(-) delete mode 100644 etc/neutron/plugins/ml2/ml2_conf_mlnx.ini delete mode 100644 neutron/plugins/ml2/drivers/mlnx/config.py diff --git a/etc/neutron/plugins/ml2/ml2_conf_mlnx.ini b/etc/neutron/plugins/ml2/ml2_conf_mlnx.ini deleted file mode 100644 index 46139aed85a..00000000000 --- a/etc/neutron/plugins/ml2/ml2_conf_mlnx.ini +++ /dev/null @@ -1,4 +0,0 @@ -[eswitch] -# (StrOpt) Type of Network Interface to allocate for VM: -# mlnx_direct or hostdev according to libvirt terminology -# vnic_type = mlnx_direct diff --git a/neutron/extensions/portbindings.py b/neutron/extensions/portbindings.py index 4e199e5004f..81dde03ffeb 100644 --- a/neutron/extensions/portbindings.py +++ b/neutron/extensions/portbindings.py @@ -59,7 +59,6 @@ VIF_TYPE_802_QBG = '802.1qbg' VIF_TYPE_802_QBH = '802.1qbh' VIF_TYPE_HYPERV = 'hyperv' VIF_TYPE_MIDONET = 'midonet' -VIF_TYPE_MLNX_DIRECT = 'mlnx_direct' VIF_TYPE_MLNX_HOSTDEV = 'hostdev' VIF_TYPE_HW_VEB = 'hw_veb' VIF_TYPE_VROUTER = 'vrouter' @@ -67,7 +66,7 @@ VIF_TYPE_OTHER = 'other' VIF_TYPES = [VIF_TYPE_UNBOUND, VIF_TYPE_BINDING_FAILED, VIF_TYPE_OVS, VIF_TYPE_IVS, VIF_TYPE_BRIDGE, VIF_TYPE_802_QBG, VIF_TYPE_802_QBH, VIF_TYPE_HYPERV, VIF_TYPE_MIDONET, - VIF_TYPE_MLNX_DIRECT, VIF_TYPE_MLNX_HOSTDEV, VIF_TYPE_HW_VEB, + VIF_TYPE_MLNX_HOSTDEV, VIF_TYPE_HW_VEB, VIF_TYPE_DVS, VIF_TYPE_OTHER, VIF_TYPE_DISTRIBUTED, VIF_TYPE_VROUTER] diff --git a/neutron/plugins/ml2/drivers/mlnx/config.py b/neutron/plugins/ml2/drivers/mlnx/config.py deleted file mode 100644 index 731190953b6..00000000000 --- a/neutron/plugins/ml2/drivers/mlnx/config.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 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 neutron.extensions import portbindings - -eswitch_opts = [ - cfg.StrOpt('vnic_type', - default=portbindings.VIF_TYPE_MLNX_DIRECT, - help=_("Type of VM network interface: mlnx_direct or " - "hostdev")), -] - - -cfg.CONF.register_opts(eswitch_opts, "ESWITCH") diff --git a/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py b/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py index e6881bc4227..6205b7fcd0b 100644 --- a/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py +++ b/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from networking_mlnx.plugins.ml2.drivers.mlnx import constants -from oslo_config import cfg from oslo_log import log from neutron.common import constants as n_const @@ -23,7 +21,6 @@ from neutron.extensions import portbindings from neutron.plugins.common import constants as p_constants from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers import mech_agent -from neutron.plugins.ml2.drivers.mlnx import config # noqa LOG = log.getLogger(__name__) @@ -40,16 +37,17 @@ class MlnxMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): def __init__(self): # REVISIT(irenab): update supported_vnic_types to contain - # only VNIC_DIRECT and VNIC_MACVTAP once its possible to specify + # only VNIC_DIRECT once its possible to specify # vnic_type via nova API/GUI. Currently VNIC_NORMAL is included # to enable VM creation via GUI. It should be noted, that if - # several MDs are capable to bing bind port on chosen host, the - # first listed MD will bind the port for VNIC_NORMAL. + # several MDs are capable to bring bind port on chosen host, the + # first listed MD will bind the port for VNIC_NORMAL super(MlnxMechanismDriver, self).__init__( - n_const.AGENT_TYPE_MLNX, - cfg.CONF.ESWITCH.vnic_type, - {portbindings.CAP_PORT_FILTER: False}, - portbindings.VNIC_TYPES) + agent_type=n_const.AGENT_TYPE_MLNX, + vif_type=portbindings.VIF_TYPE_MLNX_HOSTDEV, + vif_details={portbindings.CAP_PORT_FILTER: False}, + supported_vnic_types=[portbindings.VNIC_DIRECT, + portbindings.VNIC_NORMAL]) def get_allowed_network_types(self, agent=None): return [p_constants.TYPE_LOCAL, p_constants.TYPE_FLAT, @@ -60,12 +58,10 @@ class MlnxMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): def try_to_bind_segment_for_agent(self, context, segment, agent): if self.check_segment_for_agent(segment, agent): - vif_type = constants.VNIC_TO_VIF_MAPPING.get( - context.current[portbindings.VNIC_TYPE], self.vif_type) if (segment[api.NETWORK_TYPE] in (p_constants.TYPE_FLAT, p_constants.TYPE_VLAN)): self.vif_details['physical_network'] = segment[ 'physical_network'] context.set_binding(segment[api.ID], - vif_type, + self.vif_type, self.vif_details) diff --git a/neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py b/neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py index c055fa225ba..4aee7a4cb56 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py @@ -33,7 +33,7 @@ with mock.patch.dict(sys.modules, class MlnxMechanismBaseTestCase(base.AgentMechanismBaseTestCase): - VIF_TYPE = portbindings.VIF_TYPE_MLNX_DIRECT + VIF_TYPE = portbindings.VIF_TYPE_MLNX_HOSTDEV CAP_PORT_FILTER = False AGENT_TYPE = constants.AGENT_TYPE_MLNX @@ -60,8 +60,6 @@ class MlnxMechanismBaseTestCase(base.AgentMechanismBaseTestCase): super(MlnxMechanismBaseTestCase, self).setUp() self.driver = mech_mlnx.MlnxMechanismDriver() self.driver.initialize() - m_const_mock.constants.VNIC_TO_VIF_MAPPING.get.return_value = ( - self.driver.vif_type) class MlnxMechanismGenericTestCase(MlnxMechanismBaseTestCase, @@ -92,18 +90,9 @@ class MlnxMechanismVnicTypeTestCase(MlnxMechanismBaseTestCase, self.assertEqual(expected_vif_type, context._bound_vif_type) def test_vnic_type_direct(self): - m_const_mock.constants.VNIC_TO_VIF_MAPPING.get.return_value = ( - portbindings.VIF_TYPE_MLNX_HOSTDEV) self._check_vif_type_for_vnic_type(portbindings.VNIC_DIRECT, portbindings.VIF_TYPE_MLNX_HOSTDEV) - def test_vnic_type_macvtap(self): - m_const_mock.constants.VNIC_TO_VIF_MAPPING.get.return_value = ( - portbindings.VIF_TYPE_MLNX_DIRECT) - - self._check_vif_type_for_vnic_type(portbindings.VNIC_MACVTAP, - portbindings.VIF_TYPE_MLNX_DIRECT) - def test_vnic_type_normal(self): self._check_vif_type_for_vnic_type(portbindings.VNIC_NORMAL, self.VIF_TYPE) diff --git a/setup.cfg b/setup.cfg index a5b18a43eca..b4f24fc610a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -68,7 +68,6 @@ data_files = etc/neutron/plugins/ml2/ml2_conf_brocade.ini etc/neutron/plugins/ml2/ml2_conf_brocade_fi_ni.ini etc/neutron/plugins/ml2/ml2_conf_cisco.ini - etc/neutron/plugins/ml2/ml2_conf_mlnx.ini etc/neutron/plugins/ml2/ml2_conf_ncs.ini etc/neutron/plugins/ml2/ml2_conf_ofa.ini etc/neutron/plugins/ml2/ml2_conf_fslsdn.ini