]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: pass --timeout to cephadm binary commands
authorAdam King <adking@redhat.com>
Thu, 16 Mar 2023 18:20:48 +0000 (14:20 -0400)
committerAdam King <adking@redhat.com>
Mon, 22 May 2023 20:41:09 +0000 (16:41 -0400)
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 00d4203ec60ed42840b1b318af49e4e697bd04f2)

src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py

index 910e3a951574cae48fcadd0b864af97b8e745144..c62065342908518523f9577d59e58620e0f14147 100644 (file)
@@ -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()
index 3064e412a563b66edb100655c4c86f29270f4688..6ab77daf5143a022c5a51eb1b8d85044234bc45a 100644 (file)
@@ -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)