Skip to content

Commit

Permalink
teuthology/misc: Add timeout parameter to stop_daemons_of_type for be…
Browse files Browse the repository at this point in the history
…tter flexibility

Updated stop_daemons_of_type to accept a timeout parameter,
allowing dynamic control over the timeout value passed to the
stop function of each daemon.

Signed-off-by: Nitzan Mordechai <[email protected]>
  • Loading branch information
NitzanMordhai committed Dec 10, 2024
1 parent e4eeebd commit cbef9c6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions teuthology/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,15 +1148,17 @@ def ssh_keyscan_wait(hostname):
log.info("try ssh_keyscan again for " + str(hostname))
return success

def stop_daemons_of_type(ctx, type_, cluster='ceph'):
def stop_daemons_of_type(ctx, type_, cluster='ceph', timeout=300):
"""
:param type_: type of daemons to be stopped.
:param cluster: Cluster name, default is 'ceph'.
:param timeout: Timeout in seconds for stopping each daemon.
"""
log.info('Shutting down %s daemons...' % type_)
exc = None
for daemon in ctx.daemons.iter_daemons_of_role(type_, cluster):
try:
daemon.stop()
daemon.stop(timeout)
except (CommandFailedError,
CommandCrashedError,
ConnectionLostError) as e:
Expand Down

0 comments on commit cbef9c6

Please sign in to comment.