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

Show disk size in instance info



The size of the instance's disk was not shown in “gnt-instance info”.
This patch adds it and formats it nicely if possible.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 280b79b3
......@@ -5703,6 +5703,7 @@ class LUQueryInstanceData(NoHooksLU):
"sstatus": dev_sstatus,
"children": dev_children,
"mode": dev.mode,
"size": dev.size,
}
return data
......
......@@ -998,7 +998,11 @@ def _FormatBlockDevInfo(idx, top_level, dev, static):
txt = "disk %d" % idx
else:
txt = "child %d" % idx
d1 = ["- %s: %s" % (txt, dev["dev_type"])]
if isinstance(dev["size"], int):
nice_size = utils.FormatUnit(dev["size"], "h")
else:
nice_size = dev["size"]
d1 = ["- %s: %s, size %s" % (txt, dev["dev_type"], nice_size)]
data = []
if top_level:
data.append(("access mode", dev["mode"]))
......
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