Update primary bonding option in debian_ip.py (#39068)

* Update debian_ip.py

Add support for the "primary" bonding option in active-backup, balancd-tlb and balance-alb type bonds for Debian.  This is used to specify a preferred slave for the link.

Remove support for the balance-xor bond type, since it is not supported by the kernel.

Reference: https://www.kernel.org/doc/Documentation/networking/bonding.txt
	
"The primary option is only valid for active-backup(1), balance-tlb (5) and balance-alb (6) mode."

* Update debian_ip.py
This commit is contained in:
jak3kaj 2017-01-31 18:10:57 -05:00 committed by Nicole Thomas
parent 9836d7dd29
commit a0861f0701

View file

@ -921,6 +921,9 @@ def _parse_settings_bond_1(opts, iface, bond_def):
_log_default_iface(iface, binding, bond_def[binding])
bond.update({binding: bond_def[binding]})
if 'primary' in opts:
bond.update({'primary': opts['primary']})
if not (__grains__['os'] == "Ubuntu" and __grains__['osrelease_info'][0] >= 16):
if 'use_carrier' in opts:
if opts['use_carrier'] in _CONFIG_TRUE:
@ -974,9 +977,6 @@ def _parse_settings_bond_2(opts, iface, bond_def):
_log_default_iface(iface, 'arp_interval', bond_def['arp_interval'])
bond.update({'arp_interval': bond_def['arp_interval']})
if 'primary' in opts:
bond.update({'primary': opts['primary']})
if 'hashing-algorithm' in opts:
valid = ['layer2', 'layer2+3', 'layer3+4']
if opts['hashing-algorithm'] in valid:
@ -1107,6 +1107,9 @@ def _parse_settings_bond_5(opts, iface, bond_def):
_log_default_iface(iface, 'use_carrier', bond_def['use_carrier'])
bond.update({'use_carrier': bond_def['use_carrier']})
if 'primary' in opts:
bond.update({'primary': opts['primary']})
return bond
@ -1143,6 +1146,9 @@ def _parse_settings_bond_6(opts, iface, bond_def):
_log_default_iface(iface, 'use_carrier', bond_def['use_carrier'])
bond.update({'use_carrier': bond_def['use_carrier']})
if 'primary' in opts:
bond.update({'primary': opts['primary']})
return bond