Commit dc09c3cf authored by Iustin Pop's avatar Iustin Pop
Browse files

Make gnt-node list-storage more standard

This patch adds support for the -o+field,… format that the other list
commands accept and changes the format of the allocatable field from
simply str(bool) to Y/N.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 9b94905f
......@@ -494,9 +494,11 @@ def ListStorage(opts, args):
def_fields = ["node"] + default_fields[storage_type]
if opts.output is None:
selected_fields = ["node"]
selected_fields = def_fields
elif opts.output.startswith("+"):
selected_fields = def_fields + opts.output[1:].split(",")
selected_fields = opts.output.split(",")
......@@ -520,6 +522,17 @@ def ListStorage(opts, args):
unitfields = [constants.SF_SIZE, constants.SF_USED, constants.SF_FREE]
numfields = [constants.SF_SIZE, constants.SF_USED, constants.SF_FREE]
# change raw values to nicer strings
for row in output:
for idx, field in enumerate(selected_fields):
val = row[idx]
if field == constants.SF_ALLOCATABLE:
if val:
val = "Y"
val = "N"
row[idx] = str(val)
data = GenerateTable(separator=opts.separator, headers=headers,
fields=selected_fields, unitfields=unitfields,
numfields=numfields, data=output, units=opts.units)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment