Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

teuthology/misc: Add timeout parameter to stop_daemons_of_type for better flexibility #2014

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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