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
This commit is contained in:
Moshe Levi 2015-05-09 18:53:59 +03:00
parent dae9bf2a88
commit 3488559aba
6 changed files with 11 additions and 61 deletions

View File

@ -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

View 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]

View File

@ -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")

View 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)

View 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)

View File

@ -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