Merge "Fix Mellanox ConnectX-4 serializer with bonding"

This commit is contained in:
Jenkins 2016-09-04 13:53:01 +00:00 committed by Gerrit Code Review
commit fc918d5ce2
1 changed files with 60 additions and 42 deletions

View File

@ -90,11 +90,22 @@ class MellanoxSettings(object):
mlnx = cls.get_mlnx_section()
for network_type, ifc_dict in mlnx_interfaces.iteritems():
if 'driver' in ifc_dict and network_type in ['private','management','storage']:
# The bond interfaces extend the original list,
# otherwise, the interface is appended to the list.
if(type(ifc_dict['driver']) is list):
drivers.extend(ifc_dict['driver'])
else:
drivers.append(ifc_dict['driver'])
if(type(ifc_dict['interface']) is list):
interfaces.extend(ifc_dict['interface'])
else:
interfaces.append(ifc_dict['interface'])
drivers_set = list(set(drivers))
interfaces_set = list(set(interfaces))
if (len(drivers_set) > 1):
logging.error("Multiple ConnectX adapters was found in this environment.")
raise MellanoxSettingsException(
@ -288,6 +299,10 @@ class MellanoxSettings(object):
def is_iser_enabled(cls):
return cls.get_mlnx_section()['iser']
@classmethod
def is_sriov_enabled(cls):
return cls.get_mlnx_section()['sriov']
@classmethod
def is_vxlan_offloading_enabled(cls):
return cls.get_mlnx_section()['vxlan_offloading']
@ -434,8 +449,9 @@ class MellanoxSettings(object):
# Map networks to interfaces
for transformation in transformations:
if transformation['action'] == 'add-port' or \
transformation['action'] == 'add-bond':
if 'bridge' in transformation.keys() and \
(transformation['action'] == 'add-port' or \
transformation['action'] == 'add-bond'):
if transformation['bridge'] == 'br-fw-admin':
network_type = 'admin'
elif transformation['bridge'] == 'br-ex':
@ -465,14 +481,16 @@ class MellanoxSettings(object):
if 'bonds' in cls.data and interface in cls.data['bonds']:
network_interface['driver'] = \
cls.data['bonds'][interface]['driver']
if network_type == 'private':
if ( network_type == 'private' and cls.is_sriov_enabled() ) or \
( network_type == 'storage' and cls.is_iser_enabled() ):
# Assign SR-IOV to the first port only
network_interface['interface'] = \
cls.data['bonds'][interface]['interfaces'][0]
else:
network_interface['interface'] = \
cls.data['bonds'][interface]['interfaces']
# Assign SR-IOV/ISER to the first port only.
# This is a temporary workaround until supporing bond over VFs.
# We sort the array of interfaces in order to get the first
# interface on all nodes.
if_list = cls.data['bonds'][interface]['interfaces']
if_list.sort()
network_interface['interface'] = if_list[0]
else: # Not a bond
network_interface['driver'] = \
interfaces[interface]['vendor_specific']['driver']