From: Jozef Urbanovsky jurbanov@redhat.com
Hi,
This patchset adds OvS Bonding recipe, as well as, fixes issues with Linux Bond recipe. OvSDoubleBondRecipe is similiar to DoubleBondRecipe setup, however, it does use OvS bridge, where bond is created and connected to. Patchset itself also contains minor fixes to BondDevice with regards to LACP xmit_hash_policy setting and BaseEnrtRecipe, where it sets somewhat reasonable default value of perf_msg_sizes.
Jozef
Jozef Urbanovsky (4): lnst.Recipes.ENRT: add OvSDoubleBondRecipe lnst.Devices.BondDevice: fix xmit_hash_policy setter lnst.Recipes.ENRT.BaseEnrtRecipe: use reasonable default msg_size value lnst.Recipes.ENRT.DoubleBondRecipe: add support for all bonding modes
lnst/Devices/BondDevice.py | 7 +- lnst/Recipes/ENRT/BaseEnrtRecipe.py | 2 +- lnst/Recipes/ENRT/DoubleBondRecipe.py | 18 ++++- lnst/Recipes/ENRT/OvsDoubleBondRecipe.py | 99 ++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 lnst/Recipes/ENRT/OvsDoubleBondRecipe.py
From: Jozef Urbanovsky jurbanov@redhat.com
Signed-off-by: Jozef Urbanovsky jurbanov@redhat.com --- lnst/Recipes/ENRT/OvsDoubleBondRecipe.py | 99 ++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 lnst/Recipes/ENRT/OvsDoubleBondRecipe.py
diff --git a/lnst/Recipes/ENRT/OvsDoubleBondRecipe.py b/lnst/Recipes/ENRT/OvsDoubleBondRecipe.py new file mode 100644 index 0000000..1b527e5 --- /dev/null +++ b/lnst/Recipes/ENRT/OvsDoubleBondRecipe.py @@ -0,0 +1,99 @@ +from lnst.Common.Parameters import StrParam +from lnst.Common.IpAddress import ipaddress +from lnst.Controller import HostReq, DeviceReq, RecipeParam +from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe +from lnst.Recipes.ENRT.ConfigMixins.CommonHWSubConfigMixin import ( + CommonHWSubConfigMixin) +from lnst.Devices import OvsBridgeDevice + + +class NoVirtOvSBondRecipe(CommonHWSubConfigMixin, BaseEnrtRecipe): + host1 = HostReq() + host1.eth0 = DeviceReq(label="to_switch", driver=RecipeParam("driver")) + host1.eth1 = DeviceReq(label="to_switch", driver=RecipeParam("driver")) + + host2 = HostReq() + host2.eth0 = DeviceReq(label="to_switch", driver=RecipeParam("driver")) + host2.eth1 = DeviceReq(label="to_switch", driver=RecipeParam("driver")) + + bonding_mode = StrParam(mandatory=True) + lacp_mode = StrParam(mandatory=True) + + def test_wide_configuration(self): + host1, host2 = self.matched.host1, self.matched.host2 + + net_addr = "192.168.101" + net_addr6 = "fc00:0:0:0" + + for i, host in enumerate([host1, host2]): + host.eth0.down() + host.eth1.down() + + host.br0 = OvsBridgeDevice() + + host.br0.bond_add("bond" + str(i+1), (host.eth0, host.eth1), + bond_mode=self.params.bonding_mode, + lacp=self.params.lacp_mode) + + host.br0.ip_add(ipaddress(net_addr + "." + str(i+1) + "/24")) + host.br0.ip_add(ipaddress(net_addr6 + "::" + str(i+1) + "/64")) + + for dev in [host.eth0, host.eth1, host.br0]: + dev.up() + + configuration = super().test_wide_configuration() + configuration.test_wide_devices = [host1.br0, host2.br0] + + self.wait_tentative_ips(configuration.test_wide_devices) + + return configuration + + def generate_test_wide_description(self, config): + host1, host2 = self.matched.host1, self.matched.host2 + desc = super().generate_test_wide_description(config) + desc += [ + "\n".join([ + "Configured {}.{}.ips = {}".format( + dev.host.hostid, dev.name, dev.ips + ) + for dev in config.test_wide_devices + ]), + "\n".join([ + "Configured {}.{}.bonds = {}".format( + dev.host.hostid, dev.name, dev.bonds + ) + for dev in [host1.br0, host2.br0] + ]) + ] + return desc + + def test_wide_deconfiguration(self, config): + del config.test_wide_devices + + super().test_wide_deconfiguration(config) + + def generate_ping_endpoints(self, config): + return [(self.matched.host1.br0, self.matched.host2.br0)] + + def generate_perf_endpoints(self, config): + return [(self.matched.host1.br0, self.matched.host2.br0)] + + def wait_tentative_ips(self, devices): + def condition(): + return all( + [not ip.is_tentative for dev in devices for ip in dev.ips] + ) + + self.ctl.wait_for_condition(condition, timeout=5) + + @property + def mtu_hw_config_dev_list(self): + return [self.matched.host1.br0, self.matched.host2.br0] + + @property + def dev_interrupt_hw_config_dev_list(self): + return [self.matched.host1.eth0, self.matched.host2.eth0] + + @property + def parallel_stream_qdisc_hw_config_dev_list(self): + return [self.matched.host1.eth0, self.matched.host2.eth0]
Tue, Oct 22, 2019 at 02:36:58PM CEST, jurbanov@redhat.com wrote:
From: Jozef Urbanovsky jurbanov@redhat.com
Signed-off-by: Jozef Urbanovsky jurbanov@redhat.com
lnst/Recipes/ENRT/OvsDoubleBondRecipe.py | 99 ++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 lnst/Recipes/ENRT/OvsDoubleBondRecipe.py
diff --git a/lnst/Recipes/ENRT/OvsDoubleBondRecipe.py b/lnst/Recipes/ENRT/OvsDoubleBondRecipe.py new file mode 100644 index 0000000..1b527e5 --- /dev/null +++ b/lnst/Recipes/ENRT/OvsDoubleBondRecipe.py @@ -0,0 +1,99 @@ +from lnst.Common.Parameters import StrParam +from lnst.Common.IpAddress import ipaddress
+from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe +from lnst.Recipes.ENRT.ConfigMixins.CommonHWSubConfigMixin import (
- CommonHWSubConfigMixin)
+from lnst.Devices import OvsBridgeDevice
+class NoVirtOvSBondRecipe(CommonHWSubConfigMixin, BaseEnrtRecipe):
Please rename the class to OvSBondRecipe.
- host1 = HostReq()
- host1.eth0 = DeviceReq(label="to_switch", driver=RecipeParam("driver"))
- host1.eth1 = DeviceReq(label="to_switch", driver=RecipeParam("driver"))
- host2 = HostReq()
- host2.eth0 = DeviceReq(label="to_switch", driver=RecipeParam("driver"))
- host2.eth1 = DeviceReq(label="to_switch", driver=RecipeParam("driver"))
- bonding_mode = StrParam(mandatory=True)
- lacp_mode = StrParam(mandatory=True)
- def test_wide_configuration(self):
host1, host2 = self.matched.host1, self.matched.host2
net_addr = "192.168.101"
net_addr6 = "fc00:0:0:0"
for i, host in enumerate([host1, host2]):
host.eth0.down()
host.eth1.down()
host.br0 = OvsBridgeDevice()
host.br0.bond_add("bond" + str(i+1), (host.eth0, host.eth1),
bond_mode=self.params.bonding_mode,
lacp=self.params.lacp_mode)
host.br0.ip_add(ipaddress(net_addr + "." + str(i+1) + "/24"))
host.br0.ip_add(ipaddress(net_addr6 + "::" + str(i+1) + "/64"))
for dev in [host.eth0, host.eth1, host.br0]:
dev.up()
configuration = super().test_wide_configuration()
configuration.test_wide_devices = [host1.br0, host2.br0]
self.wait_tentative_ips(configuration.test_wide_devices)
return configuration
- def generate_test_wide_description(self, config):
host1, host2 = self.matched.host1, self.matched.host2
desc = super().generate_test_wide_description(config)
desc += [
"\n".join([
"Configured {}.{}.ips = {}".format(
dev.host.hostid, dev.name, dev.ips
)
for dev in config.test_wide_devices
]),
"\n".join([
"Configured {}.{}.bonds = {}".format(
dev.host.hostid, dev.name, dev.bonds
)
for dev in [host1.br0, host2.br0]
])
]
return desc
- def test_wide_deconfiguration(self, config):
del config.test_wide_devices
super().test_wide_deconfiguration(config)
- def generate_ping_endpoints(self, config):
return [(self.matched.host1.br0, self.matched.host2.br0)]
- def generate_perf_endpoints(self, config):
return [(self.matched.host1.br0, self.matched.host2.br0)]
- def wait_tentative_ips(self, devices):
def condition():
return all(
[not ip.is_tentative for dev in devices for ip in dev.ips]
)
self.ctl.wait_for_condition(condition, timeout=5)
- @property
- def mtu_hw_config_dev_list(self):
return [self.matched.host1.br0, self.matched.host2.br0]
- @property
- def dev_interrupt_hw_config_dev_list(self):
return [self.matched.host1.eth0, self.matched.host2.eth0]
- @property
- def parallel_stream_qdisc_hw_config_dev_list(self):
return [self.matched.host1.eth0, self.matched.host2.eth0]
-- 2.21.0 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@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.fedorahos...
From: Jozef Urbanovsky jurbanov@redhat.com
IFLA_BOND_XMIT_HASH_POLICY requires numeral value of the setting, dict was created to represent correct values of xmit_hash_policy in kernel
Signed-off-by: Jozef Urbanovsky jurbanov@redhat.com --- lnst/Devices/BondDevice.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lnst/Devices/BondDevice.py b/lnst/Devices/BondDevice.py index ce01427..48f4de6 100644 --- a/lnst/Devices/BondDevice.py +++ b/lnst/Devices/BondDevice.py @@ -354,12 +354,15 @@ class BondDevice(MasterDevice):
@xmit_hash_policy.setter def xmit_hash_policy(self, val): - m = ["layer2", "layer2+3", "layer3+4", "encap2+3", "encap3+4"] + m = {"layer2": 0, "layer3+4": 1, "layer2+3": 2, + "encap2+3": 3, "encap3+4": 4}
if val in m: + self._set_linkinfo_data_attr("IFLA_BOND_XMIT_HASH_POLICY", m[val]) + elif val in m.values(): self._set_linkinfo_data_attr("IFLA_BOND_XMIT_HASH_POLICY", val) else: - raise DeviceConfigError("Invalid value, must be in {}}.".format(m)) + raise DeviceConfigError("Invalid value, must be in {}.".format(m)) self._nl_link_sync("set")
@property
Tue, Oct 22, 2019 at 02:36:59PM CEST, jurbanov@redhat.com wrote:
From: Jozef Urbanovsky jurbanov@redhat.com
IFLA_BOND_XMIT_HASH_POLICY requires numeral value of the setting, dict was created to represent correct values of xmit_hash_policy in kernel
Signed-off-by: Jozef Urbanovsky jurbanov@redhat.com
lnst/Devices/BondDevice.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lnst/Devices/BondDevice.py b/lnst/Devices/BondDevice.py index ce01427..48f4de6 100644 --- a/lnst/Devices/BondDevice.py +++ b/lnst/Devices/BondDevice.py @@ -354,12 +354,15 @@ class BondDevice(MasterDevice):
@xmit_hash_policy.setter def xmit_hash_policy(self, val):
m = ["layer2", "layer2+3", "layer3+4", "encap2+3", "encap3+4"]
m = {"layer2": 0, "layer3+4": 1, "layer2+3": 2,
"encap2+3": 3, "encap3+4": 4} if val in m:
self._set_linkinfo_data_attr("IFLA_BOND_XMIT_HASH_POLICY", m[val])
elif val in m.values(): self._set_linkinfo_data_attr("IFLA_BOND_XMIT_HASH_POLICY", val) else:
raise DeviceConfigError("Invalid value, must be in {}}.".format(m))
raise DeviceConfigError("Invalid value, must be in {}.".format(m))
This would print following message:
Invalid value, must be in {'layer2': 0, 'layer3+4': 1, 'layer2+3': 2, 'encap2+3': 3, 'encap3+4': 4}.
That looks ugly.
How about the following: ... .format(list(m.keys()) + list(m.values())
Which would print:
Invalid value, must be in ['layer2', 'layer3+4', 'layer2+3', 'encap2+3', 'encap3+4', 0, 1, 2, 3, 4].
self._nl_link_sync("set") @property
-- 2.21.0 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@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.fedorahos...
From: Jozef Urbanovsky jurbanov@redhat.com
Signed-off-by: Jozef Urbanovsky jurbanov@redhat.com --- lnst/Recipes/ENRT/BaseEnrtRecipe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py b/lnst/Recipes/ENRT/BaseEnrtRecipe.py index 5862311..34718e7 100644 --- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py +++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py @@ -38,7 +38,7 @@ class BaseEnrtRecipe(BaseSubConfigMixin, PingTestAndEvaluate, PerfRecipe): perf_duration = IntParam(default=60) perf_iterations = IntParam(default=5) perf_parallel_streams = IntParam(default=1) - perf_msg_sizes = ListParam(default=[123]) + perf_msg_sizes = ListParam(default=[16384]) perf_reverse = BoolParam(default=False)
net_perf_tool = Param(default=IperfFlowMeasurement)
From: Jozef Urbanovsky jurbanov@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@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
Tue, Oct 22, 2019 at 02:37:01PM CEST, jurbanov@redhat.com wrote:
From: Jozef Urbanovsky jurbanov@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@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@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@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.fedorahos...
Disregard this patchset.
I've talked more with mcroce and the setup we require is different. We need 2 OvS bridges and possibly different traffic generator, if we also use DPDK. Also there is a need to talk to Fouad, as he should know what customers use more.
Jozef
On Tue, Oct 22, 2019 at 2:37 PM jurbanov@redhat.com wrote:
From: Jozef Urbanovsky jurbanov@redhat.com
Hi,
This patchset adds OvS Bonding recipe, as well as, fixes issues with Linux Bond recipe. OvSDoubleBondRecipe is similiar to DoubleBondRecipe setup, however, it does use OvS bridge, where bond is created and connected to. Patchset itself also contains minor fixes to BondDevice with regards to LACP xmit_hash_policy setting and BaseEnrtRecipe, where it sets somewhat reasonable default value of perf_msg_sizes.
Jozef
Jozef Urbanovsky (4): lnst.Recipes.ENRT: add OvSDoubleBondRecipe lnst.Devices.BondDevice: fix xmit_hash_policy setter lnst.Recipes.ENRT.BaseEnrtRecipe: use reasonable default msg_size value lnst.Recipes.ENRT.DoubleBondRecipe: add support for all bonding modes
lnst/Devices/BondDevice.py | 7 +- lnst/Recipes/ENRT/BaseEnrtRecipe.py | 2 +- lnst/Recipes/ENRT/DoubleBondRecipe.py | 18 ++++- lnst/Recipes/ENRT/OvsDoubleBondRecipe.py | 99 ++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 lnst/Recipes/ENRT/OvsDoubleBondRecipe.py
-- 2.21.0
lnst-developers@lists.fedorahosted.org