When killing leftover Ganeti processes, also
kill the ganeti jobs running as processes
(Ganeti 2.12 onwards). As the actual process
is python, which is a bit unspecific, we grep
for ganeti/jqueue/exec.py in the full command
line.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 roles/buildmaster/files/srv/buildbot/lib/scripts/qa-cleanup | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/roles/buildmaster/files/srv/buildbot/lib/scripts/qa-cleanup 
b/roles/buildmaster/files/srv/buildbot/lib/scripts/qa-cleanup
index 8b6adb5..0f4c1c7 100755
--- a/roles/buildmaster/files/srv/buildbot/lib/scripts/qa-cleanup
+++ b/roles/buildmaster/files/srv/buildbot/lib/scripts/qa-cleanup
@@ -3,6 +3,7 @@
 set -e -u
 
 process_re='^(ganeti-.*|gnt-.*|kvm|socat|import-export)$'
+process_f_re='.*/ganeti/jqueue/exec.py'
 
 # Do this before killing processes, so ganeti-watcher won't restart daemons or
 # instances
@@ -14,6 +15,12 @@ for dir in /var/lib/ganeti /srv/ganeti/vcluster; do
 done
 
 echo Killing daemons and other processes... >&2
+
+while pgrep -f "$process_f_re"; do
+  pkill -f -9 "$process_f_re" || :
+  sleep 1
+done
+
 while pgrep "$process_re"; do
   pkill -9 "$process_re" || :
   sleep 1
-- 
2.0.0.526.g5318336

Reply via email to