Tue, Oct 22, 2019 at 02:37:01PM CEST, jurbanov(a)redhat.com wrote:
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())
I'm not quite sure if this is the correct approach.
Since this can be useful in other recipes that configure a BondDevice,
it should be implemented at the LNST core and not in this Recipe class.
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":
The bonding mode can be specified also by a number, in case of 802.3ad
that is 4.
Also, we should handle the case when the parameter is not specified as
the parameter gets mandatory here.
+ kwargs["xmit_hash_policy"] =
self.params.xmit_hash_policy
+
+ return kwargs
--
2.21.0
_______________________________________________
LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...