]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
orchestra/daemon: add finished() method in DaemonState and CephadmUnit
authorVallari Agrawal <val.agl002@gmail.com>
Thu, 27 Jun 2024 16:45:10 +0000 (22:15 +0530)
committerVallari Agrawal <val.agl002@gmail.com>
Fri, 28 Jun 2024 12:10:30 +0000 (17:40 +0530)
These are to be used by DaemonWatchdog to determine if
DaemonState/CephadmUnit daemons are active or finished.

Signed-off-by: Vallari Agrawal <val.agl002@gmail.com>
teuthology/orchestra/daemon/cephadmunit.py
teuthology/orchestra/daemon/state.py

index 7b10f819fa85b0e96f46326e50d210744e37830f..f4959b17370dc66e8e8184dc877de714476836d5 100644 (file)
@@ -112,6 +112,18 @@ class CephadmUnit(DaemonState):
         """
         return self.is_started
 
+    def finished(self):
+        """
+        Is the daemon finished? 
+        Return False if active.
+        """
+        proc = self.remote.run(
+            args=self.status_cmd,
+            check_status=False,
+            quiet=True,
+        )
+        return proc.returncode != 0
+
     def signal(self, sig, silent=False):
         """
         Send a signal to associated remote command
index c3b6ddad933378943b8907c5255389cb855027b6..03387c9991d1cfa1a3eb358ebdbc72dc07ef7c30 100644 (file)
@@ -97,6 +97,13 @@ class DaemonState(object):
         """
         return self.proc is not None
 
+    def finished(self):
+        """
+        Is the daemon finished? 
+        Return False if active.
+        """
+        return self.proc.finished if self.proc is not None else False
+
     def signal(self, sig, silent=False):
         """
         Send a signal to associated remote command.