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
Show replies by date