From 68593df8818fc24a81d62478fcc5ebb02e347b58 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Mon, 14 Sep 2020 14:28:16 +0200 Subject: [PATCH] mgr/cephadm: make `ceph orch {restart|...}` asynchronous Othwerwiese we'd block the CLI handler thread. Signed-off-by: Sebastian Wagner (cherry picked from commit c6e4b9ab9ca317c840613167df9ec17fe6173592) --- src/pybind/mgr/cephadm/module.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 31e2fb84a2ea..d40d403f0ecd 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1417,22 +1417,12 @@ To check that the host is reachable: @trivial_completion def service_action(self, action: str, service_name: str) -> List[str]: - args = [] - for host, dm in self.cache.daemons.items(): - for name, d in dm.items(): - if d.matches_service(service_name): - args.append((d.daemon_type, d.daemon_id, - d.hostname, action)) + dds: List[DaemonDescription] = self.cache.get_daemons_by_service(service_name) self.log.info('%s service %s' % (action.capitalize(), service_name)) - return self._daemon_actions(args) - - @forall_hosts - def _daemon_actions(self, daemon_type: str, daemon_id: str, host: str, action: str) -> str: - with set_exception_subject('daemon', DaemonDescription( - daemon_type=daemon_type, - daemon_id=daemon_id - ).name()): - return self._daemon_action(daemon_type, daemon_id, host, action) + return [ + self._schedule_daemon_action(dd.name(), action) + for dd in dds + ] def _daemon_action(self, daemon_type: str, daemon_id: str, host: str, action: str, image: Optional[str] = None) -> str: daemon_spec: CephadmDaemonSpec = CephadmDaemonSpec( -- 2.47.3