]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/vstart_runner: don't use os.kill for passing SIGKILL
authorRishabh Dave <ridave@redhat.com>
Sat, 25 Sep 2021 10:33:25 +0000 (16:03 +0530)
committerRishabh Dave <ridave@redhat.com>
Mon, 2 May 2022 14:55:19 +0000 (20:25 +0530)
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 <PID>", instead of
using os.kill() because os.kill() can't kill process launched with
superuser privileges.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/vstart_runner.py

index 341fb036a3c2a5c916715fe1230b94ab5c2851c4..1203a6769e6b6fb13e1bc8a3c71ef69e4873ac10 100644 (file)
@@ -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: