]> git-server-git.apps.pok.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>
Wed, 24 May 2023 17:51:52 +0000 (13:51 -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 e5e5a8eebb94907311311cf6c2fb1043aa64ce52..c020b87600a9b548402862bb93dd25bbe960a305 100644 (file)
@@ -407,6 +407,13 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
             default=False,
             desc='Log all refresh metadata. Includes daemon, device, and host info collected regularly. Only has effect if logging at debug level'
         ),
+        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):
@@ -479,6 +486,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 0c6a0b208d32e4c24dbccadd8f5fb04bee30e435..6d5e0cd0f3f9b70583b8fdfe091dd98e611ab419 100644 (file)
@@ -1381,6 +1381,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
@@ -1419,6 +1420,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)