From: Sebastian Wagner Date: Mon, 14 Sep 2020 12:28:16 +0000 (+0200) Subject: mgr/cephadm: make `ceph orch {restart|...}` asynchronous X-Git-Tag: v15.2.9~52^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=68593df8818fc24a81d62478fcc5ebb02e347b58;p=ceph.git 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) --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 31e2fb84a2ea5..d40d403f0ecd5 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(