]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
mlnx MD: mlnx_direct removal
authorMoshe Levi <moshele@mellanox.com>
Sat, 9 May 2015 15:53:59 +0000 (18:53 +0300)
committerMoshe Levi <moshele@mellanox.com>
Tue, 12 May 2015 09:44:25 +0000 (12:44 +0300)
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 [deleted file]
neutron/extensions/portbindings.py
neutron/plugins/ml2/drivers/mlnx/config.py [deleted file]
neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py
neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py
setup.cfg

diff --git a/etc/neutron/plugins/ml2/ml2_conf_mlnx.ini b/etc/neutron/plugins/ml2/ml2_conf_mlnx.ini
deleted file mode 100644 (file)
index 46139ae..0000000
+++ /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
index 4e199e5004fa54c59f08da752aa1f7b765fe3ca2..81dde03ffeb63cdb36913442ab631769523470ac 100644 (file)
@@ -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 (file)
index 7311909..0000000
+++ /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")
index e6881bc422792ee68d392b679d77b1956e157d5e..6205b7fcd0b8561a94ee4aa858bd539ab9b203b5 100644 (file)
@@ -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)
index c055fa225ba2933689d2608de10df60ececcc409..4aee7a4cb56dc32786804cb5217c01a24cb042a5 100644 (file)
@@ -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)
index a5b18a43eca28280ec8ed0b83b5048424117c745..b4f24fc610aad64eae738b83ad47fd9108b23b6c 100644 (file)
--- 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