Merge "Fix Mellanox ConnectX-4 serializer with bonding"
This commit is contained in:
commit
fc918d5ce2
|
@ -90,11 +90,22 @@ class MellanoxSettings(object):
|
||||||
mlnx = cls.get_mlnx_section()
|
mlnx = cls.get_mlnx_section()
|
||||||
for network_type, ifc_dict in mlnx_interfaces.iteritems():
|
for network_type, ifc_dict in mlnx_interfaces.iteritems():
|
||||||
if 'driver' in ifc_dict and network_type in ['private','management','storage']:
|
if 'driver' in ifc_dict and network_type in ['private','management','storage']:
|
||||||
drivers.append(ifc_dict['driver'])
|
|
||||||
interfaces.append(ifc_dict['interface'])
|
# 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))
|
drivers_set = list(set(drivers))
|
||||||
interfaces_set = list(set(interfaces))
|
interfaces_set = list(set(interfaces))
|
||||||
|
|
||||||
if (len(drivers_set) > 1):
|
if (len(drivers_set) > 1):
|
||||||
logging.error("Multiple ConnectX adapters was found in this environment.")
|
logging.error("Multiple ConnectX adapters was found in this environment.")
|
||||||
raise MellanoxSettingsException(
|
raise MellanoxSettingsException(
|
||||||
|
@ -288,6 +299,10 @@ class MellanoxSettings(object):
|
||||||
def is_iser_enabled(cls):
|
def is_iser_enabled(cls):
|
||||||
return cls.get_mlnx_section()['iser']
|
return cls.get_mlnx_section()['iser']
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def is_sriov_enabled(cls):
|
||||||
|
return cls.get_mlnx_section()['sriov']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_vxlan_offloading_enabled(cls):
|
def is_vxlan_offloading_enabled(cls):
|
||||||
return cls.get_mlnx_section()['vxlan_offloading']
|
return cls.get_mlnx_section()['vxlan_offloading']
|
||||||
|
@ -434,49 +449,52 @@ class MellanoxSettings(object):
|
||||||
|
|
||||||
# Map networks to interfaces
|
# Map networks to interfaces
|
||||||
for transformation in transformations:
|
for transformation in transformations:
|
||||||
if transformation['action'] == 'add-port' or \
|
if 'bridge' in transformation.keys() and \
|
||||||
transformation['action'] == 'add-bond':
|
(transformation['action'] == 'add-port' or \
|
||||||
if transformation['bridge'] == 'br-fw-admin':
|
transformation['action'] == 'add-bond'):
|
||||||
network_type = 'admin'
|
if transformation['bridge'] == 'br-fw-admin':
|
||||||
elif transformation['bridge'] == 'br-ex':
|
network_type = 'admin'
|
||||||
network_type = 'public'
|
elif transformation['bridge'] == 'br-ex':
|
||||||
elif transformation['bridge'] == 'br-aux' or \
|
network_type = 'public'
|
||||||
transformation['bridge'] == 'br-mesh':
|
elif transformation['bridge'] == 'br-aux' or \
|
||||||
network_type = 'private'
|
transformation['bridge'] == 'br-mesh':
|
||||||
elif transformation['bridge'] == 'br-mgmt':
|
network_type = 'private'
|
||||||
network_type = 'management'
|
elif transformation['bridge'] == 'br-mgmt':
|
||||||
elif transformation['bridge'] == 'br-storage':
|
network_type = 'management'
|
||||||
network_type = 'storage'
|
elif transformation['bridge'] == 'br-storage':
|
||||||
elif transformation['bridge'] == 'br-baremetal':
|
network_type = 'storage'
|
||||||
network_type = 'baremetal'
|
elif transformation['bridge'] == 'br-baremetal':
|
||||||
|
network_type = 'baremetal'
|
||||||
|
|
||||||
network_interface = {}
|
network_interface = {}
|
||||||
network_interface['bridge'] = transformation['bridge']
|
network_interface['bridge'] = transformation['bridge']
|
||||||
|
|
||||||
# Split to iface name and VLAN
|
# Split to iface name and VLAN
|
||||||
iface_split = transformation['name'].split('.')
|
iface_split = transformation['name'].split('.')
|
||||||
if len(iface_split)==1:
|
if len(iface_split)==1:
|
||||||
iface_split.append(str(1))
|
iface_split.append(str(1))
|
||||||
interface, vlan = iface_split
|
interface, vlan = iface_split
|
||||||
network_interface['interface'] = interface
|
network_interface['interface'] = interface
|
||||||
network_interface['vlan'] = vlan
|
network_interface['vlan'] = vlan
|
||||||
|
|
||||||
# If bond
|
# If bond
|
||||||
if 'bonds' in cls.data and interface in cls.data['bonds']:
|
if 'bonds' in cls.data and interface in cls.data['bonds']:
|
||||||
network_interface['driver'] = \
|
network_interface['driver'] = \
|
||||||
cls.data['bonds'][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'] = \
|
# Assign SR-IOV/ISER to the first port only.
|
||||||
cls.data['bonds'][interface]['interfaces'][0]
|
# This is a temporary workaround until supporing bond over VFs.
|
||||||
else:
|
# We sort the array of interfaces in order to get the first
|
||||||
network_interface['interface'] = \
|
# interface on all nodes.
|
||||||
cls.data['bonds'][interface]['interfaces']
|
if_list = cls.data['bonds'][interface]['interfaces']
|
||||||
else: # Not a bond
|
if_list.sort()
|
||||||
network_interface['driver'] = \
|
network_interface['interface'] = if_list[0]
|
||||||
interfaces[interface]['vendor_specific']['driver']
|
else: # Not a bond
|
||||||
dict_of_interfaces[network_type] = network_interface
|
network_interface['driver'] = \
|
||||||
|
interfaces[interface]['vendor_specific']['driver']
|
||||||
|
dict_of_interfaces[network_type] = network_interface
|
||||||
|
|
||||||
# Set private network in case private and storage on the same port
|
# Set private network in case private and storage on the same port
|
||||||
if 'private' not in dict_of_interfaces.keys() and \
|
if 'private' not in dict_of_interfaces.keys() and \
|
||||||
|
|
Loading…
Reference in New Issue