]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/vstart_runner: more robust stop() on daemons
authorJohn Spray <john.spray@redhat.com>
Sun, 25 Dec 2016 16:45:36 +0000 (16:45 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 5 Jan 2017 13:43:39 +0000 (13:43 +0000)
Previously this could get hung up if we killed one
PID and then the daemon reappears with a different
one (perhaps because we caught it during
daemonization?)

Signed-off-by: John Spray <john.spray@redhat.com>
qa/tasks/vstart_runner.py

index 629c89162b9b33fea085c991962438806f66ebb5..05ff7d9c3257183111b7f3f44427b9f6e98425ab 100644 (file)
@@ -343,6 +343,25 @@ class LocalDaemon(object):
         pid = self._get_pid()
         log.info("Killing PID {0} for {1}.{2}".format(pid, self.daemon_type, self.daemon_id))
         os.kill(pid, signal.SIGKILL)
+
+        waited = 0
+        while pid is not None:
+            new_pid = self._get_pid()
+            if new_pid is not None and new_pid != pid:
+                log.info("Killing new PID {0}".format(new_pid))
+                pid = new_pid
+                os.kill(pid, signal.SIGKILL)
+
+            if new_pid is None:
+                break
+            else:
+                if waited > timeout:
+                    raise MaxWhileTries(
+                        "Timed out waiting for daemon {0}.{1}".format(
+                            self.daemon_type, self.daemon_id))
+                time.sleep(1)
+                waited += 1
+
         self.wait(timeout=timeout)
 
     def restart(self):