summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-09-04 13:53:01 +0000
committerGerrit Code Review <review@openstack.org>2016-09-04 13:53:01 +0000
commitfc918d5ce2539db1b717bf56e2c72d6fbc32da7c (patch)
treedcac3670a29a69913acd509c7957bd957ded594e
parent1cc2834698d3faad1dfc04f412e79200ee409ca6 (diff)
parentfae6863b010dbe36e5dc0a5638c7000e0d1d1b19 (diff)
Merge "Fix Mellanox ConnectX-4 serializer with bonding"
-rwxr-xr-xdeployment_scripts/mellanox_settings.py108
1 files changed, 63 insertions, 45 deletions
diff --git a/deployment_scripts/mellanox_settings.py b/deployment_scripts/mellanox_settings.py
index d16ede3..1f2462b 100755
--- a/deployment_scripts/mellanox_settings.py
+++ b/deployment_scripts/mellanox_settings.py
@@ -90,11 +90,22 @@ class MellanoxSettings(object):
90 mlnx = cls.get_mlnx_section() 90 mlnx = cls.get_mlnx_section()
91 for network_type, ifc_dict in mlnx_interfaces.iteritems(): 91 for network_type, ifc_dict in mlnx_interfaces.iteritems():
92 if 'driver' in ifc_dict and network_type in ['private','management','storage']: 92 if 'driver' in ifc_dict and network_type in ['private','management','storage']:
93 drivers.append(ifc_dict['driver']) 93
94 interfaces.append(ifc_dict['interface']) 94 # The bond interfaces extend the original list,
95 # otherwise, the interface is appended to the list.
96 if(type(ifc_dict['driver']) is list):
97 drivers.extend(ifc_dict['driver'])
98 else:
99 drivers.append(ifc_dict['driver'])
100
101 if(type(ifc_dict['interface']) is list):
102 interfaces.extend(ifc_dict['interface'])
103 else:
104 interfaces.append(ifc_dict['interface'])
95 105
96 drivers_set = list(set(drivers)) 106 drivers_set = list(set(drivers))
97 interfaces_set = list(set(interfaces)) 107 interfaces_set = list(set(interfaces))
108
98 if (len(drivers_set) > 1): 109 if (len(drivers_set) > 1):
99 logging.error("Multiple ConnectX adapters was found in this environment.") 110 logging.error("Multiple ConnectX adapters was found in this environment.")
100 raise MellanoxSettingsException( 111 raise MellanoxSettingsException(
@@ -289,6 +300,10 @@ class MellanoxSettings(object):
289 return cls.get_mlnx_section()['iser'] 300 return cls.get_mlnx_section()['iser']
290 301
291 @classmethod 302 @classmethod
303 def is_sriov_enabled(cls):
304 return cls.get_mlnx_section()['sriov']
305
306 @classmethod
292 def is_vxlan_offloading_enabled(cls): 307 def is_vxlan_offloading_enabled(cls):
293 return cls.get_mlnx_section()['vxlan_offloading'] 308 return cls.get_mlnx_section()['vxlan_offloading']
294 309
@@ -434,49 +449,52 @@ class MellanoxSettings(object):
434 449
435 # Map networks to interfaces 450 # Map networks to interfaces
436 for transformation in transformations: 451 for transformation in transformations:
437 if transformation['action'] == 'add-port' or \ 452 if 'bridge' in transformation.keys() and \
438 transformation['action'] == 'add-bond': 453 (transformation['action'] == 'add-port' or \
439 if transformation['bridge'] == 'br-fw-admin': 454 transformation['action'] == 'add-bond'):
440 network_type = 'admin' 455 if transformation['bridge'] == 'br-fw-admin':
441 elif transformation['bridge'] == 'br-ex': 456 network_type = 'admin'
442 network_type = 'public' 457 elif transformation['bridge'] == 'br-ex':
443 elif transformation['bridge'] == 'br-aux' or \ 458 network_type = 'public'
444 transformation['bridge'] == 'br-mesh': 459 elif transformation['bridge'] == 'br-aux' or \
445 network_type = 'private' 460 transformation['bridge'] == 'br-mesh':
446 elif transformation['bridge'] == 'br-mgmt': 461 network_type = 'private'
447 network_type = 'management' 462 elif transformation['bridge'] == 'br-mgmt':
448 elif transformation['bridge'] == 'br-storage': 463 network_type = 'management'
449 network_type = 'storage' 464 elif transformation['bridge'] == 'br-storage':
450 elif transformation['bridge'] == 'br-baremetal': 465 network_type = 'storage'
451 network_type = 'baremetal' 466 elif transformation['bridge'] == 'br-baremetal':
452 467 network_type = 'baremetal'
453 network_interface = {} 468
454 network_interface['bridge'] = transformation['bridge'] 469 network_interface = {}
455 470 network_interface['bridge'] = transformation['bridge']
456 # Split to iface name and VLAN 471
457 iface_split = transformation['name'].split('.') 472 # Split to iface name and VLAN
458 if len(iface_split)==1: 473 iface_split = transformation['name'].split('.')
459 iface_split.append(str(1)) 474 if len(iface_split)==1:
460 interface, vlan = iface_split 475 iface_split.append(str(1))
461 network_interface['interface'] = interface 476 interface, vlan = iface_split
462 network_interface['vlan'] = vlan 477 network_interface['interface'] = interface
463 478 network_interface['vlan'] = vlan
464 # If bond 479
465 if 'bonds' in cls.data and interface in cls.data['bonds']: 480 # If bond
466 network_interface['driver'] = \ 481 if 'bonds' in cls.data and interface in cls.data['bonds']:
467 cls.data['bonds'][interface]['driver'] 482 network_interface['driver'] = \
468 if network_type == 'private': 483 cls.data['bonds'][interface]['driver']
469 484 if ( network_type == 'private' and cls.is_sriov_enabled() ) or \
470 # Assign SR-IOV to the first port only 485 ( network_type == 'storage' and cls.is_iser_enabled() ):
471 network_interface['interface'] = \ 486
472 cls.data['bonds'][interface]['interfaces'][0] 487 # Assign SR-IOV/ISER to the first port only.
473 else: 488 # This is a temporary workaround until supporing bond over VFs.
474 network_interface['interface'] = \ 489 # We sort the array of interfaces in order to get the first
475 cls.data['bonds'][interface]['interfaces'] 490 # interface on all nodes.
476 else: # Not a bond 491 if_list = cls.data['bonds'][interface]['interfaces']
477 network_interface['driver'] = \ 492 if_list.sort()
478 interfaces[interface]['vendor_specific']['driver'] 493 network_interface['interface'] = if_list[0]
479 dict_of_interfaces[network_type] = network_interface 494 else: # Not a bond
495 network_interface['driver'] = \
496 interfaces[interface]['vendor_specific']['driver']
497 dict_of_interfaces[network_type] = network_interface
480 498
481 # Set private network in case private and storage on the same port 499 # Set private network in case private and storage on the same port
482 if 'private' not in dict_of_interfaces.keys() and \ 500 if 'private' not in dict_of_interfaces.keys() and \