From 69232d72828b3b960b7d4cacedd5cf25c23fc733 Mon Sep 17 00:00:00 2001 From: Adam King Date: Thu, 16 Mar 2023 14:20:48 -0400 Subject: [PATCH] mgr/cephadm: pass --timeout to cephadm binary commands Signed-off-by: Adam King (cherry picked from commit 00d4203ec60ed42840b1b318af49e4e697bd04f2) --- src/pybind/mgr/cephadm/module.py | 8 ++++++++ src/pybind/mgr/cephadm/serve.py | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 910e3a95157..c6206534290 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -472,6 +472,13 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, default=False, desc='Enable TLS security for all the monitoring stack daemons' ), + Option( + 'default_cephadm_command_timeout', + type='secs', + default=15 * 60, + desc='Default timeout applied to cephadm commands run directly on ' + 'the host (in seconds)' + ), ] def __init__(self, *args: Any, **kwargs: Any): @@ -554,6 +561,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, self.device_enhanced_scan = False self.cgroups_split = True self.log_refresh_metadata = False + self.default_cephadm_command_timeout = 0 self.notify(NotifyType.mon_map, None) self.config_notify() diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 3064e412a56..6ab77daf514 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -1420,6 +1420,7 @@ class CephadmServe: image: Optional[str] = "", env_vars: Optional[List[str]] = None, log_output: Optional[bool] = True, + timeout: Optional[int] = None, # timeout in seconds ) -> Tuple[List[str], List[str], int]: """ Run cephadm on the remote host with the given command + args @@ -1458,6 +1459,11 @@ class CephadmServe: if not self.mgr.cgroups_split: final_args += ['--no-cgroups-split'] + if not timeout: + # 15 minute global timeout if no timeout was passed + timeout = self.mgr.default_cephadm_command_timeout + final_args += ['--timeout', str(timeout)] + # subcommand final_args.append(command) -- 2.39.5