The controller now uses graceful killing of a command that timeouts. This is needed if we want to keep the output of the command.
Also we need to set fail flag on the result in that case. The reason is that for example IcmpPing module would report that it has passed based on processing data of interrupted ping command within the module.
Signed-off-by: Jan Tluka jtluka@redhat.com --- lnst/Controller/Machine.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py index 5d8db7d..da63197 100644 --- a/lnst/Controller/Machine.py +++ b/lnst/Controller/Machine.py @@ -330,15 +330,20 @@ class Machine(object): except MachineError as exc: if "proc_id" in command: cmd_res = self._rpc_call_x(netns, "kill_command", - command["proc_id"]) + command["proc_id"], True) else: cmd_res = self._rpc_call_x(netns, "kill_command", - None) + None, True)
if "killed" in cmd_res and cmd_res["killed"]: cmd_res["passed"] = False cmd_res["msg"] = str(exc)
+ if "gracefully_killed" in cmd_res and \ + cmd_res["gracefully_killed"]: + cmd_res["passed"] = False + cmd_res["msg"] = "Command gracefully killed on timeout" + signal.alarm(0) signal.signal(signal.SIGALRM, prev_handler)