From: Jozef Urbanovsky <jurbanov(a)redhat.com>
Bonding mode 802.3ad (LACP) requires xmit_hash_policy to be set.
However, other bonding modes do not use this value, therefore
auxiliary method has been created to handle BondDevice kwargs.
Signed-off-by: Jozef Urbanovsky <jurbanov(a)redhat.com>
---
lnst/Recipes/ENRT/DoubleBondRecipe.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/lnst/Recipes/ENRT/DoubleBondRecipe.py
b/lnst/Recipes/ENRT/DoubleBondRecipe.py
index c375928..06eac9c 100644
--- a/lnst/Recipes/ENRT/DoubleBondRecipe.py
+++ b/lnst/Recipes/ENRT/DoubleBondRecipe.py
@@ -26,6 +26,7 @@ class DoubleBondRecipe(CommonHWSubConfigMixin, OffloadSubConfigMixin,
bonding_mode = StrParam(mandatory=True)
miimon_value = IntParam(mandatory=True)
+ xmit_hash_policy = StrParam(mandatory=False)
def test_wide_configuration(self):
host1, host2 = self.matched.host1, self.matched.host2
@@ -33,8 +34,7 @@ class DoubleBondRecipe(CommonHWSubConfigMixin, OffloadSubConfigMixin,
net_addr = "192.168.101"
net_addr6 = "fc00:0:0:0"
for i, host in enumerate([host1, host2]):
- host.bond0 = BondDevice(mode=self.params.bonding_mode,
- miimon=self.params.miimon_value)
+ host.bond0 = BondDevice(**self._create_bond_kwargs())
for dev in [host.eth0, host.eth1]:
dev.down()
host.bond0.slave_add(dev)
@@ -80,6 +80,12 @@ class DoubleBondRecipe(CommonHWSubConfigMixin, OffloadSubConfigMixin,
dev.host.hostid, dev.name, dev.miimon
)
for dev in config.test_wide_devices
+ ]),
+ "\n".join([
+ "Configured {}.{}.xmit_hash_policy = {}".format(
+ dev.host.hostid, dev.name, dev.xmit_hash_policy
+ )
+ for dev in config.test_wide_devices
])
]
return desc
@@ -125,3 +131,11 @@ class DoubleBondRecipe(CommonHWSubConfigMixin,
OffloadSubConfigMixin,
def parallel_stream_qdisc_hw_config_dev_list(self):
host1, host2 = self.matched.host1, self.matched.host2
return [host1.eth0, host1.eth1, host2.eth0, host2.eth1]
+
+ def _create_bond_kwargs(self):
+ kwargs = {"mode": self.params.bonding_mode, "miimon":
self.params.miimon_value}
+
+ if self.params.bonding_mode == "802.3ad":
+ kwargs["xmit_hash_policy"] = self.params.xmit_hash_policy
+
+ return kwargs
--
2.21.0