]> git.apps.os.sepia.ceph.com Git - ceph-ci.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>
Tue, 25 Apr 2023 14:11:39 +0000 (10:11 -0400)
Signed-off-by: Adam King <adking@redhat.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py

index 555a405ee5e2abc3e12c343222ef0f88562e0a17..159449fe5822f4d58ffb229be48ec815403f224a 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 3778baa875480a634a26416a77bdc97a4f852db5..ea8a67590a9e2f8a6a0ad043143b7046c2ace3be 100644 (file)
@@ -1421,6 +1421,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
@@ -1459,6 +1460,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)