.flags = VSH_OFLAG_REQ,
.help = N_("block device")
},
+ {.name = "human",
+ .type = VSH_OT_BOOL,
+ .help = N_("Human readable output")
+ },
{.name = NULL}
};
virDomainBlockInfo info;
virDomainPtr dom;
bool ret = false;
+ bool human = false;
const char *device = NULL;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
if (virDomainGetBlockInfo(dom, device, &info, 0) < 0)
goto cleanup;
- vshPrint(ctl, "%-15s %llu\n", _("Capacity:"), info.capacity);
- vshPrint(ctl, "%-15s %llu\n", _("Allocation:"), info.allocation);
- vshPrint(ctl, "%-15s %llu\n", _("Physical:"), info.physical);
+ human = vshCommandOptBool(cmd, "human");
+
+ if (!human) {
+ vshPrint(ctl, "%-15s %llu\n", _("Capacity:"), info.capacity);
+ vshPrint(ctl, "%-15s %llu\n", _("Allocation:"), info.allocation);
+ vshPrint(ctl, "%-15s %llu\n", _("Physical:"), info.physical);
+ } else {
+ double val;
+ const char *unit;
+
+ val = vshPrettyCapacity(info.capacity, &unit);
+ vshPrint(ctl, "%-15s %-.3lf %s\n", _("Capacity:"), val, unit);
+ val = vshPrettyCapacity(info.allocation, &unit);
+ vshPrint(ctl, "%-15s %-.3lf %s\n", _("Allocation:"), val, unit);
+ val = vshPrettyCapacity(info.physical, &unit);
+ vshPrint(ctl, "%-15s %-.3lf %s\n", _("Physical:"), val, unit);
+ }
ret = true;
The B<domblkerror> command lists all block devices in error state and
the error seen on each of them.
-=item B<domblkinfo> I<domain> I<block-device>
+=item B<domblkinfo> I<domain> I<block-device> [I<--human>]
Get block device size info for a domain. A I<block-device> corresponds
to a unique target name (<target dev='name'/>) or source file (<source
file='name'/>) for one of the disk devices attached to I<domain> (see
-also B<domblklist> for listing these names).
+also B<domblklist> for listing these names). If I<--human> is set, the
+output will have a human readable output.
=item B<domblklist> I<domain> [I<--inactive>] [I<--details>]