]> www.infradead.org Git - users/dhowells/kafs-utils.git/commitdiff
Fix the output of "vos listvldb"
authorDavid Howells <dhowells@redhat.com>
Tue, 13 May 2014 16:30:45 +0000 (17:30 +0100)
committerDavid Howells <dhowells@redhat.com>
Tue, 13 May 2014 16:30:45 +0000 (17:30 +0100)
Fix the output of "vos listvldb" in the following ways:

 (1) Print a blank line between records in the output.

 (2) Adjust the indentation.

 (3) Don't print RW/RO/Backup volume IDs if the corresponding VLSF_xxVOL
     flag is not set.

Signed-off-by: David Howells <dhowells@redhat.com>
suite/commands/vos/listvldb.py
suite/lib/voldisplay.py

index 43914dddbc30264d58f76355008fa4a9371fbdd3..28a62845032bc7835a951dec4d7ac4e8cdaaec69 100644 (file)
@@ -62,11 +62,17 @@ Displays a volume's VLDB entry
 def print_record(params, vldb):
     """Display a single VLDB record"""
     output(vldb.name, "\n")
-    outputf(" RWrite: {:<12d} ROnly: {:<12d} Backup: {:<12d}\n",
-            vldb.volumeId[0],
-            vldb.volumeId[1],
-            vldb.volumeId[2])
-    display_vldb_site_list(params, vldb)
+    output("   ");
+    flags = vldb.serverFlags[0]
+    if flags & kafs.VLSF_RWVOL:
+        outputf(" RWrite: {:<12d}", vldb.volumeId[0])
+    if flags & kafs.VLSF_ROVOL:
+        outputf(" ROnly: {:<12d}", vldb.volumeId[1])
+    if flags & kafs.VLSF_BACKVOL:
+        outputf(" Backup: {:<12d}",vldb.volumeId[2])
+    output("\n")
+    display_vldb_site_list(params, vldb, "    ")
+    output("\n")
 
 def main(params):
     # Get a list of VLDB servers to query
index 2ae7ade006c515cfeacb9af0f05325488d3bc2d3..eed0c42e4d363226fecd06dc805c83a0a8fcaccc 100644 (file)
@@ -93,7 +93,7 @@ def display_vldb_site_list(params, vldb, indent=""):
         else:
             ptype = "Back"
 
-        outputf("{:s}    server {:s} partition {:s} {:s} Site\n",
+        outputf("{:s}   server {:s} partition {:s} {:s} Site\n",
                 indent, addr, part, ptype)
 
     if vldb.flags & (kafs.VLOP_MOVE |