From: Paul Cuzner Date: Mon, 18 Jan 2021 22:01:08 +0000 (+1300) Subject: mgr/orchestrator: rebase including the --detail X-Git-Tag: v16.2.0~178^2~62 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=52caef35fda4dda4107a288b2b14780ca90aef11;p=ceph.git mgr/orchestrator: rebase including the --detail Signed-off-by: Paul Cuzner (cherry picked from commit 83a25c5e23b2e4cdc87309ecf41c86483e0c30cd) --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index cf3e80bdbfd3..1d7538aee194 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -532,9 +532,6 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, def is_paused(self) -> bool: return self.paused - def worker_pool_size(self) -> int: - return self._worker_pool._processes # type: ignore - def pause(self) -> None: if not self.paused: self.log.info('Paused') @@ -690,7 +687,8 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, return ok, err if not self.ssh_key or not self.ssh_pub: return False, 'SSH keys not set. Use `ceph cephadm set-priv-key` and `ceph cephadm set-pub-key` or `ceph cephadm generate-key`' - return True, '' + + return True, str(self._worker_pool._processes) # type: ignore def process(self, completions: List[CephadmCompletion]) -> None: # type: ignore """ diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index b765bffa1ffb..fbc1e083542c 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1345,7 +1345,9 @@ Usage: return HandleCommandResult() @_cli_read_command('orch status') - def _status(self, format: Format = Format.plain) -> HandleCommandResult: + def _status(self, + detail: bool = False, + format: Format = Format.plain) -> HandleCommandResult: """Report configured backend and its status""" o = self._select_orchestrator() if o is None: @@ -1357,24 +1359,20 @@ Usage: "paused": self.is_paused(), } - try: - num_workers = self.worker_pool_size() - except NotImplementedError: - pass - else: - result['workers'] = num_workers - if avail is not None: result['available'] = avail - if not avail: - result['reason'] = why + if avail: + if o == "cephadm" and detail: + result['workers'] = msg + else: + result['reason'] = msg if format != Format.plain: output = to_format(result, format, many=False, cls=None) else: output = "Backend: {0}".format(result['backend']) if 'available' in result: - output += "\nAvailable: {0}".format(result['available']) + output += f"\nAvailable: {'Yes' if result['available'] else 'No'}" if 'reason' in result: output += ' ({0})'.format(result['reason']) output += f"\nPaused: {'Yes' if result['paused'] else 'No'}"