From 2c2208ab07410175ebc82845b2159cdf16c3912b Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Thu, 1 Nov 2018 23:24:38 -0400 Subject: [PATCH] Tweak some output formatting in lists --- client-common/ceph.py | 12 ++++++------ client-common/node.py | 16 ++++++++-------- client-common/vm.py | 10 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/client-common/ceph.py b/client-common/ceph.py index f951a0c4..4c05bafa 100644 --- a/client-common/ceph.py +++ b/client-common/ceph.py @@ -487,13 +487,13 @@ def formatPoolList(zk_conn, pool_list): {pool_id: <{pool_id_length}} \ {pool_name: <{pool_name_length}} \ {pool_size: <{pool_size_length}} \ -Objects: {pool_objects: <{pool_objects_length}} \ +Obj: {pool_objects: <{pool_objects_length}} \ {pool_clones: <{pool_clones_length}} \ {pool_copies: <{pool_copies_length}} \ {pool_degraded: <{pool_degraded_length}} \ -Read: {pool_read_ops: <{pool_read_ops_length}} \ +Rd: {pool_read_ops: <{pool_read_ops_length}} \ {pool_read_data: <{pool_read_data_length}} \ -Write: {pool_write_ops: <{pool_write_ops_length}} \ +Wr: {pool_write_ops: <{pool_write_ops_length}} \ {pool_write_data: <{pool_write_data_length}} \ {end_bold}'.format( bold=ansiprint.bold(), @@ -528,13 +528,13 @@ Write: {pool_write_ops: <{pool_write_ops_length}} \ {pool_id: <{pool_id_length}} \ {pool_name: <{pool_name_length}} \ {pool_size: <{pool_size_length}} \ - {pool_objects: <{pool_objects_length}} \ + {pool_objects: <{pool_objects_length}} \ {pool_clones: <{pool_clones_length}} \ {pool_copies: <{pool_copies_length}} \ {pool_degraded: <{pool_degraded_length}} \ - {pool_read_ops: <{pool_read_ops_length}} \ + {pool_read_ops: <{pool_read_ops_length}} \ {pool_read_data: <{pool_read_data_length}} \ - {pool_write_ops: <{pool_write_ops_length}} \ + {pool_write_ops: <{pool_write_ops_length}} \ {pool_write_data: <{pool_write_data_length}} \ {end_bold}'.format( bold=ansiprint.bold(), diff --git a/client-common/node.py b/client-common/node.py index b7d31359..62939a30 100644 --- a/client-common/node.py +++ b/client-common/node.py @@ -285,10 +285,10 @@ def get_list(zk_conn, limit): # Format the string (header) node_list_output.append( - '{bold}{node_name: <{node_name_length}} \ -State: {daemon_state_colour}{node_daemon_state: <{daemon_state_length}}{end_colour} {router_state_colour}{node_router_state: <{router_state_length}}{end_colour} {domain_state_colour}{node_domain_state: <{domain_state_length}}{end_colour} \ -Resources: {node_domains_count: <4} {node_cpu_count: <5} {node_load: <6} \ -RAM (MiB): {node_mem_total: <6} {node_mem_used: <6} {node_mem_free: <6} {node_mem_allocated: <6}{end_bold}'.format( + '{bold}{node_name: <{node_name_length}} \ +St: {daemon_state_colour}{node_daemon_state: <{daemon_state_length}}{end_colour} {router_state_colour}{node_router_state: <{router_state_length}}{end_colour} {domain_state_colour}{node_domain_state: <{domain_state_length}}{end_colour} \ +Res: {node_domains_count: <4} {node_cpu_count: <5} {node_load: <5} \ +Mem (M): {node_mem_total: <6} {node_mem_used: <6} {node_mem_free: <6} {node_mem_allocated: <6}{end_bold}'.format( node_name_length=node_name_length, daemon_state_length=daemon_state_length, router_state_length=router_state_length, @@ -342,10 +342,10 @@ RAM (MiB): {node_mem_total: <6} {node_mem_used: <6} {node_mem_free: <6} {node_me domain_state_colour = ansiprint.blue() node_list_output.append( - '{bold}{node_name: <{node_name_length}} \ - {daemon_state_colour}{node_daemon_state: <{daemon_state_length}}{end_colour} {router_state_colour}{node_router_state: <{router_state_length}}{end_colour} {domain_state_colour}{node_domain_state: <{domain_state_length}}{end_colour} \ - {node_domains_count: <4} {node_cpu_count: <5} {node_load: <6} \ - {node_mem_total: <6} {node_mem_used: <6} {node_mem_free: <6} {node_mem_allocated: <6}{end_bold}'.format( + '{bold}{node_name: <{node_name_length}} \ + {daemon_state_colour}{node_daemon_state: <{daemon_state_length}}{end_colour} {router_state_colour}{node_router_state: <{router_state_length}}{end_colour} {domain_state_colour}{node_domain_state: <{domain_state_length}}{end_colour} \ + {node_domains_count: <4} {node_cpu_count: <5} {node_load: <5} \ + {node_mem_total: <6} {node_mem_used: <6} {node_mem_free: <6} {node_mem_allocated: <6}{end_bold}'.format( node_name_length=node_name_length, daemon_state_length=daemon_state_length, router_state_length=router_state_length, diff --git a/client-common/vm.py b/client-common/vm.py index 6c954868..97a90285 100644 --- a/client-common/vm.py +++ b/client-common/vm.py @@ -70,7 +70,7 @@ def getInformationFromXML(zk_conn, uuid, long_output): ainformation.append('{}UUID:{} {}'.format(ansiprint.purple(), ansiprint.end(), duuid)) ainformation.append('{}Name:{} {}'.format(ansiprint.purple(), ansiprint.end(), dname)) ainformation.append('{}Description:{} {}'.format(ansiprint.purple(), ansiprint.end(), ddescription)) - ainformation.append('{}Memory (MiB):{} {}'.format(ansiprint.purple(), ansiprint.end(), dmemory)) + ainformation.append('{}Memory (M):{} {}'.format(ansiprint.purple(), ansiprint.end(), dmemory)) ainformation.append('{}vCPUs:{} {}'.format(ansiprint.purple(), ansiprint.end(), dvcpu)) ainformation.append('{}Topology (S/C/T):{} {}'.format(ansiprint.purple(), ansiprint.end(), dvcputopo)) @@ -560,7 +560,7 @@ def get_list(zk_conn, node, limit): # Determine optimal column widths # Dynamic columns: node_name, node, migrated - vm_name_length = 10 + vm_name_length = 5 vm_node_length = 8 vm_nets_length = 9 vm_migrated_length = 10 @@ -588,7 +588,7 @@ def get_list(zk_conn, node, limit): '{bold}{vm_name: <{vm_name_length}} {vm_uuid: <37} \ {vm_state_colour}{vm_state: <8}{end_colour} \ {vm_networks: <{vm_nets_length}} \ -{vm_memory: <10} {vm_vcpu: <6} \ +{vm_memory: <8} {vm_vcpu: <6} \ {vm_node: <{vm_node_length}} \ {vm_migrated: <{vm_migrated_length}}{end_bold}'.format( vm_name_length=vm_name_length, @@ -603,7 +603,7 @@ def get_list(zk_conn, node, limit): vm_uuid='UUID', vm_state='State', vm_networks='Networks', - vm_memory='RAM (MiB)', + vm_memory='RAM (M)', vm_vcpu='vCPUs', vm_node='Node', vm_migrated='Migrated' @@ -639,7 +639,7 @@ def get_list(zk_conn, node, limit): '{bold}{vm_name: <{vm_name_length}} {vm_uuid: <37} \ {vm_state_colour}{vm_state: <8}{end_colour} \ {vm_nets_colour}{vm_networks: <{vm_nets_length}}{end_colour} \ -{vm_memory: <10} {vm_vcpu: <6} \ +{vm_memory: <8} {vm_vcpu: <6} \ {vm_node: <{vm_node_length}} \ {vm_migrated: <{vm_migrated_length}}{end_bold}'.format( vm_name_length=vm_name_length,