]> 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)
committerPaul Cuzner <pcuzner@redhat.com>
Tue, 2 Feb 2021 22:47:49 +0000 (11:47 +1300)
Signed-off-by: Paul Cuzner <pcuzner@redhat.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/orchestrator/module.py

index afd0292c45da2283b2c0276b84b0363bec7d1a49..ae7f4a02929d9450fe2b3f07eece81f00d27ec20 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 c33d00a3a57e63c29d0ba1ffc378f4a725e43d80..6f6a637bc0c118def6123680af35fe4053eb2f55 100644 (file)
@@ -1343,7 +1343,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:
@@ -1355,24 +1357,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'}"