[PATCH v2 1/4] Machine: fix timeout kill_command for netns commands
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
If a command was running in a network namespace and timed out, the
kill_command rpc request was sent to the main lnst-slave process instead
of the netns one. This commit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Machine.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index c360e6c..8a40ceb 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -302,10 +302,20 @@ class Machine(object):
else:
cmd_res = self._rpc_call("run_command", command)
except MachineError as exc:
- if "proc_id" in command:
- cmd_res = self._rpc_call("kill_command", command["proc_id"])
+ if command["netns"] is not None:
+ netns = command["netns"]
+ if "proc_id" in command:
+ cmd_res = self._rpc_call_to_netns(netns, "kill_command",
+ command["proc_id"])
+ else:
+ cmd_res = self._rpc_call_to_netns(netns, "kill_command",
+ None)
else:
- cmd_res = self._rpc_call("kill_command", None)
+ if "proc_id" in command:
+ cmd_res = self._rpc_call("kill_command", command["proc_id"])
+ else:
+ cmd_res = self._rpc_call("kill_command", None)
+
cmd_res["passed"] = False
cmd_res["msg"] = str(exc)
--
2.5.0
8 years, 9 months
[PATCH] recipes: typo fixes in phase1 and phase2 tests
by Jan Tluka
While checking virtual phase2 tests I hit few errors during run that
turned out to be mainly copy paste errors. There's also one quite old ipv6
address typo and one syntax error while building netperf module
parameters.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
.../phase1/virtual_bridge_2_vlans_over_bond.py | 12 ++++++------
.../regression_tests/phase2/round_robin_double_team.xml | 2 +-
.../virtual_ovs_bridge_2_vlans_over_active_backup_bond.py | 14 +++++++-------
.../phase2/virtual_ovs_bridge_vlan_in_guest.py | 4 ++--
.../phase2/virtual_ovs_bridge_vlan_in_host.py | 4 ++--
5 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
index eb021f8..643b4b0 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
@@ -241,8 +241,8 @@ for offload in offloads:
server_proc = g1.run(netperf_srv, bg=True)
ctl.wait(2)
- result_tcp = g3.run(netperf_cli_tcp, timeout = int(netperf_duration)*5 + 20)
- result_udp = g3.run(netperf_cli_udp, timeout = int(netperf_duration)*5 + 20)
+ tcp_res_data = g3.run(netperf_cli_tcp, timeout = int(netperf_duration)*5 + 20)
+ udp_res_data = g3.run(netperf_cli_udp, timeout = int(netperf_duration)*5 + 20)
server_proc.intr()
if result_tcp is not None and\
@@ -258,7 +258,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -320,8 +320,8 @@ for offload in offloads:
server_proc = g1.run(netperf_srv6, bg=True)
ctl.wait(2)
- result_tcp = g3.run(netperf_cli_tcp6, timeout = int(netperf_duration)*5 + 20)
- result_udp = g3.run(netperf_cli_udp6, timeout = int(netperf_duration)*5 + 20)
+ tcp_res_data = g3.run(netperf_cli_tcp6, timeout = int(netperf_duration)*5 + 20)
+ udp_res_data = g3.run(netperf_cli_udp6, timeout = int(netperf_duration)*5 + 20)
server_proc.intr()
if result_tcp is not None and tcp_res_data.get_result() is not None and\
@@ -336,7 +336,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase2/round_robin_double_team.xml b/recipes/regression_tests/phase2/round_robin_double_team.xml
index ed85c65..817ea72 100644
--- a/recipes/regression_tests/phase2/round_robin_double_team.xml
+++ b/recipes/regression_tests/phase2/round_robin_double_team.xml
@@ -25,7 +25,7 @@
</slaves>
<addresses>
<address value="192.168.0.1/24" />
- <address value="2002::2/64" />
+ <address value="2002::1/64" />
</addresses>
</team>
</interfaces>
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
index 3ac8cb9..ec2f75b 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
@@ -124,7 +124,7 @@ netperf_cli_tcp6 = ctl.get_module("Netperf",
"testname" : "TCP_STREAM",
"confidence" : "99,5",
"netperf_opts" :
- -i 5 "-L %s -6" % g3.get_ip("guestnic", 1)
+ "-i 5 -L %s -6" % g3.get_ip("guestnic", 1)
})
netperf_cli_udp6 = ctl.get_module("Netperf",
@@ -243,8 +243,8 @@ for offload in offloads:
server_proc = g1.run(netperf_srv, bg=True)
ctl.wait(2)
- result_tcp = g3.run(netperf_cli_tcp, timeout = int(netperf_duration)*5 + 20)
- result_udp = g3.run(netperf_cli_udp, timeout = int(netperf_duration)*5 + 20)
+ tcp_res_data = g3.run(netperf_cli_tcp, timeout = int(netperf_duration)*5 + 20)
+ udp_res_data = g3.run(netperf_cli_udp, timeout = int(netperf_duration)*5 + 20)
server_proc.intr()
if result_tcp is not None and\
@@ -260,7 +260,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -322,8 +322,8 @@ for offload in offloads:
server_proc = g1.run(netperf_srv6, bg=True)
ctl.wait(2)
- result_tcp = g3.run(netperf_cli_tcp6, timeout = int(netperf_duration)*5 + 20)
- result_udp = g3.run(netperf_cli_udp6, timeout = int(netperf_duration)*5 + 20)
+ tcp_res_data = g3.run(netperf_cli_tcp6, timeout = int(netperf_duration)*5 + 20)
+ udp_res_data = g3.run(netperf_cli_udp6, timeout = int(netperf_duration)*5 + 20)
server_proc.intr()
if result_tcp is not None and tcp_res_data.get_result() is not None and\
@@ -338,7 +338,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
index 24ea12d..31d69cb 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
@@ -193,7 +193,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -269,7 +269,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
index c9b68bf..05cc40b 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
@@ -189,7 +189,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -264,7 +264,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
--
2.1.0
8 years, 9 months
[PATCH 1/4] Slave: add get_devices_by_params to SlaveMethods
by Jan Tluka
Method get_devices_by_params can be used for more variable queries for
example query by both driver name and hardware address. Basically
everything that provides Device::get_if_data(). Method has one parameter
params that is a dictionary of queried parameter key-values.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Slave/NetTestSlave.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index a725a62..0c9e627 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -154,6 +154,21 @@ class SlaveMethods:
return matched
+ def get_devices_by_params(self, params):
+ devices = self._if_manager.get_devices()
+ matched = []
+ for dev in devices:
+ dev_data = dev.get_if_data()
+ for key, value in params.iteritems():
+ if dev_data[key] != value:
+ break
+
+ entry = {"name": dev.get_name(),
+ "hwaddr": dev.get_hwaddr()}
+ matched.append(entry)
+
+ return matched
+
def get_if_data(self, if_id):
dev = self._if_manager.get_mapped_device(if_id)
if dev is None:
--
2.1.0
8 years, 9 months
[PATCH 1/4] Machine: fix timeout kill_command for netns commands
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
If a command was running in a network namespace and timed out, the
kill_command rpc request was sent to the main lnst-slave process instead
of the netns one. This commit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Machine.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index c360e6c..8a40ceb 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -302,10 +302,20 @@ class Machine(object):
else:
cmd_res = self._rpc_call("run_command", command)
except MachineError as exc:
- if "proc_id" in command:
- cmd_res = self._rpc_call("kill_command", command["proc_id"])
+ if command["netns"] is not None:
+ netns = command["netns"]
+ if "proc_id" in command:
+ cmd_res = self._rpc_call_to_netns(netns, "kill_command",
+ command["proc_id"])
+ else:
+ cmd_res = self._rpc_call_to_netns(netns, "kill_command",
+ None)
else:
- cmd_res = self._rpc_call("kill_command", None)
+ if "proc_id" in command:
+ cmd_res = self._rpc_call("kill_command", command["proc_id"])
+ else:
+ cmd_res = self._rpc_call("kill_command", None)
+
cmd_res["passed"] = False
cmd_res["msg"] = str(exc)
--
2.5.0
8 years, 9 months
[PATCH 1/3] phase1: fix copy paste error in python task
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
Forgot to save the netperf result in a variable.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
.../regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
index 39d3079..eb021f8 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
@@ -241,8 +241,8 @@ for offload in offloads:
server_proc = g1.run(netperf_srv, bg=True)
ctl.wait(2)
- g3.run(netperf_cli_tcp, timeout = int(netperf_duration)*5 + 20)
- g3.run(netperf_cli_udp, timeout = int(netperf_duration)*5 + 20)
+ result_tcp = g3.run(netperf_cli_tcp, timeout = int(netperf_duration)*5 + 20)
+ result_udp = g3.run(netperf_cli_udp, timeout = int(netperf_duration)*5 + 20)
server_proc.intr()
if result_tcp is not None and\
@@ -320,8 +320,8 @@ for offload in offloads:
server_proc = g1.run(netperf_srv6, bg=True)
ctl.wait(2)
- g3.run(netperf_cli_tcp6, timeout = int(netperf_duration)*5 + 20)
- g3.run(netperf_cli_udp6, timeout = int(netperf_duration)*5 + 20)
+ result_tcp = g3.run(netperf_cli_tcp6, timeout = int(netperf_duration)*5 + 20)
+ result_udp = g3.run(netperf_cli_udp6, timeout = int(netperf_duration)*5 + 20)
server_proc.intr()
if result_tcp is not None and tcp_res_data.get_result() is not None and\
--
2.5.0
8 years, 9 months