Skip to content

Commit

Permalink
Merge pull request #1961 from VallariAg/add-daemon-finished
Browse files Browse the repository at this point in the history
orchestra/daemon: add finished() method in DaemonState and CephadmUnit
  • Loading branch information
zmc authored Jul 1, 2024
2 parents 544fecb + 2c6d64a commit 46f457e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
16 changes: 14 additions & 2 deletions teuthology/orchestra/daemon/cephadmunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def _set_commands(self):

def kill_cmd(self, sig):
return ' '.join([
'sudo', 'docker', 'kill',
'sudo', 'systemctl', 'kill',
'-s', str(int(sig)),
'ceph-%s-%s.%s' % (self.fsid, self.type_, self.id_),
'ceph-%s@%s.%s' % (self.fsid, self.type_, self.id_),
])

def _start_logger(self):
Expand Down Expand Up @@ -112,6 +112,18 @@ def running(self):
"""
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
Expand Down
7 changes: 7 additions & 0 deletions teuthology/orchestra/daemon/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ def running(self):
"""
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.
Expand Down

0 comments on commit 46f457e

Please sign in to comment.