]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/orchestrator_cli: combine all host into one 'device ls' table
authorSage Weil <sage@redhat.com>
Mon, 16 Dec 2019 18:56:24 +0000 (12:56 -0600)
committerSage Weil <sage@redhat.com>
Mon, 16 Dec 2019 18:58:24 +0000 (12:58 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/orchestrator_cli/module.py

index 1a003cbcaff1a72e9a65044ed08f30a3c3ad6664..56d264ec136eda2392b913c039db2082cef1900f 100644 (file)
@@ -247,19 +247,19 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule):
         else:
             out = []
 
+            table = PrettyTable(
+                ['HOST', 'PATH', 'TYPE', 'SIZE', 'DEVICE', 'AVAIL',
+                 'REJECT REASONS'],
+                border=False)
+            table.align = 'l'
+            table._align['SIZE'] = 'r'
+            table.left_padding_width = 0
+            table.right_padding_width = 1
             for host in completion.result: # type: orchestrator.InventoryNode
-                out.append('Host {}:'.format(host.name))
-                table = PrettyTable(
-                    ['PATH', 'TYPE', 'SIZE', 'DEVICE', 'AVAIL',
-                     'REJECT REASONS'],
-                    border=False)
-                table.align = 'l'
-                table._align['SIZE'] = 'r'
-                table.left_padding_width = 0
-                table.right_padding_width = 1
                 for d in host.devices.devices:  # type: Device
                     table.add_row(
                         (
+                            host.name,
                             d.path,
                             d.human_readable_type,
                             format_bytes(d.sys_api.get('size', 0), 5, colored=False),
@@ -268,7 +268,7 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule):
                             ', '.join(d.rejected_reasons)
                         )
                     )
-                out.append(table.get_string())
+            out.append(table.get_string())
             return HandleCommandResult(stdout='\n'.join(out))
 
     @orchestrator._cli_read_command(