]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orchestrator: rebase including the --detail
authorPaul Cuzner <pcuzner@redhat.com>
Mon, 18 Jan 2021 22:01:08 +0000 (11:01 +1300)
committerSebastian Wagner <sebastian.wagner@suse.com>
Mon, 22 Feb 2021 16:34:11 +0000 (17:34 +0100)
Signed-off-by: Paul Cuzner <pcuzner@redhat.com>
(cherry picked from commit 83a25c5e23b2e4cdc87309ecf41c86483e0c30cd)

src/pybind/mgr/cephadm/module.py
src/pybind/mgr/orchestrator/module.py

index cf3e80bdbfd3b09d81d5582557abec32812d5e90..1d7538aee194dbad6e9f8a564c12bd1d0ac6e1a7 100644 (file)
@@ -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
         """
index b765bffa1ffb1272b040849cd08787f648d49e78..fbc1e083542cd2c90dd7943a7ac0541178196499 100644 (file)
@@ -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'}"