Added support for setting bond-lacp-rate and bond-xmit_hash_policy

With this change you can optionally specify bond_lacp_rate and/or
bond-xmit_hash_policy. If not specified, they will be added with
default values.

This change also makes bond_miimon optional, with a default of 0.

Change-Id: I6dffb693c49197398e795006afc120b9b0ba7073
Signed-off-by: Matt Mulsow <mamulsow@us.ibm.com>
This commit is contained in:
Matt Mulsow 2016-07-06 18:36:33 -05:00
parent 4fb9fcb6a2
commit 36f36e01b2
3 changed files with 25 additions and 3 deletions

View File

@ -385,7 +385,11 @@ def write_debian_interfaces(interfaces, sys_interfaces):
interface['mac_address'])
result += " bond-mode {0}\n".format(interface['bond_mode'])
result += " bond-miimon {0}\n".format(
interface['bond_miimon'])
interface.get('bond_miimon', 0))
result += " bond-lacp-rate {0}\n".format(
interface.get('bond_lacp_rate', 'slow'))
result += " bond-xmit_hash_policy {0}\n".format(
interface.get('bond_xmit_hash_policy', 'layer2'))
slave_devices = [sys_interfaces[mac]
for mac in interface['raw_macs']]
slaves = ' '.join(slave_devices)
@ -405,7 +409,11 @@ def write_debian_interfaces(interfaces, sys_interfaces):
interface['mac_address'])
result += " bond-mode {0}\n".format(interface['bond_mode'])
result += " bond-miimon {0}\n".format(
interface['bond_miimon'])
interface.get('bond_miimon', 0))
result += " bond-lacp-rate {0}\n".format(
interface.get('bond_lacp_rate', 'slow'))
result += " bond-xmit_hash_policy {0}\n".format(
interface.get('bond_xmit_hash_policy', 'layer2'))
slave_devices = [sys_interfaces[mac]
for mac in interface['raw_macs']]
slaves = ' '.join(slave_devices)
@ -436,7 +444,11 @@ def write_debian_interfaces(interfaces, sys_interfaces):
interface['mac_address'])
result += " bond-mode {0}\n".format(interface['bond_mode'])
result += " bond-miimon {0}\n".format(
interface['bond_miimon'])
interface.get('bond_miimon', 0))
result += " bond-lacp-rate {0}\n".format(
interface.get('bond_lacp_rate', 'slow'))
result += " bond-xmit_hash_policy {0}\n".format(
interface.get('bond_xmit_hash_policy', 'layer2'))
slave_devices = [sys_interfaces[mac]
for mac in interface['raw_macs']]
slaves = ' '.join(slave_devices)

View File

@ -44,6 +44,8 @@ iface bond0 inet dhcp
hwaddress bc:76:4e:05:7b:13
bond-mode 802.3ad
bond-miimon 100
bond-lacp-rate slow
bond-xmit_hash_policy layer3+4
bond-slaves eth5 eth6
### Write /etc/network/interfaces.d/eth7.cfg
auto eth7
@ -59,6 +61,8 @@ iface bond1 inet manual
hwaddress bc:76:4e:05:7b:15
bond-mode 802.3ad
bond-miimon 100
bond-lacp-rate slow
bond-xmit_hash_policy layer3+4
bond-slaves eth7 eth8
### Write /etc/network/interfaces.d/bond1.27.cfg
auto bond1.27
@ -71,6 +75,8 @@ iface bond2 inet static
hwaddress bc:76:4e:05:7b:17
bond-mode 802.3ad
bond-miimon 100
bond-lacp-rate slow
bond-xmit_hash_policy layer3+4
bond-slaves eth9 eth10
address 192.0.2.2
netmask 255.255.255.0

View File

@ -44,6 +44,8 @@ iface bond0 inet dhcp
hwaddress bc:76:4e:05:7b:13
bond-mode 802.3ad
bond-miimon 100
bond-lacp-rate slow
bond-xmit_hash_policy layer3+4
bond-slaves eth5 eth6
### Write /etc/network/interfaces.d/eth7.cfg
auto eth7
@ -59,6 +61,8 @@ iface bond1 inet manual
hwaddress bc:76:4e:05:7b:15
bond-mode 802.3ad
bond-miimon 100
bond-lacp-rate slow
bond-xmit_hash_policy layer3+4
bond-slaves eth7 eth8
### Write /etc/network/interfaces.d/bond1.27.cfg
auto bond1.27