From: Rishabh Dave Date: Sat, 25 Sep 2021 10:33:25 +0000 (+0530) Subject: qa/vstart_runner: don't use os.kill for passing SIGKILL X-Git-Tag: v18.0.0~956^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f12536fed18847134caeca5e813328a6536b01f6;p=ceph.git qa/vstart_runner: don't use os.kill for passing SIGKILL vstart_runner.py is written assuming that it can run commands with superuser privileges whenever possible and vstart_runner.py is meant to be executed without sudo. So, it's better kill a process using "sudo kill -9 ", instead of using os.kill() because os.kill() can't kill process launched with superuser privileges. Signed-off-by: Rishabh Dave --- diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index 341fb036a3c2..1203a6769e6b 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -609,7 +609,8 @@ def safe_kill(pid): os.kill annoyingly raises exception if process already dead. Ignore it. """ try: - return os.kill(pid, signal.SIGKILL) + return remote.run(args=f'sudo kill -{signal.SIGKILL.value} {pid}', + omit_sudo=False) except OSError as e: if e.errno == errno.ESRCH: # Raced with process termination @@ -1354,7 +1355,8 @@ def exec_test(): if 'ceph-fuse' in line or 'ceph-mds' in line: pid = int(line.split()[0]) log.warning("Killing stray process {0}".format(line)) - os.kill(pid, signal.SIGKILL) + remote.run(args=f'sudo kill -{signal.SIGKILL.value} {pid}', + omit_sudo=False) # Fire up the Ceph cluster if the user requested it if opt_create_cluster or opt_create_cluster_only: