On 06/18/2010 02:30 AM, Justin Clift wrote:
This patch adds a new --details option to the virsh pool-list
command, making its output more useful to people who use virsh
for significant lengths of time.
Addresses BZ # 605543
https://bugzilla.redhat.com/show_bug.cgi?id=605543
---
Output from the new option (hopefully this doesn't wrap):
virsh # pool-list --all --details
Name State Autostart Persistent Capacity Allocation Available
--------------------------------------------------------------------------------------
default running yes yes 1.79 TB 1.47 TB 326.02 GB
image_dir running yes yes 1.79 TB 1.47 TB 326.02 GB
tmp inactive no yes - - -
Didn't wrap for me, and yes, it looks nice.
@@ -4937,36 +4940,114 @@ cmdPoolList(vshControl *ctl, const vshCmd
*cmd ATTRIBUTE_UNUSED)
qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter);
}
}
- vshPrintExtra(ctl, "%-20s %-10s %-10s\n", _("Name"),
_("State"), _("Autostart"));
- vshPrintExtra(ctl, "-----------------------------------------\n");
+
+ /* Display the appropriate heading */
+ if (details) {
+ vshPrintExtra(ctl, "%-20s %-10s %-10s %-11s %-9s %-11s %-10s\n",
+ _("Name"), _("State"),
_("Autostart"), _("Persistent"),
+ _("Capacity"), _("Allocation"),
_("Available"));
If a translation of one of those headers is longer than the field width
in your printf format string, it may lead to awkward formatting in other
languages. But you're not the first instance of that issue, and it is
not a show-stopper for this patch (rather, it points to something that
we may want to clean up in the future).
- vshPrint(ctl, "%-20s %-10s %-10s\n",
- virStoragePoolGetName(pool),
- _("active"),
- autostartStr);
+ /* If requested, collect the extended information for this pool */
+ if (details) {
+ if (virStoragePoolGetInfo(pool, &info) != 0) {
+ vshError(ctl, "%s", _("Could not retrieve pool
information"));
+ VIR_FREE(activeNames[i]);
+ continue;
Indentation is wonky here (3-5-4 instead of 4-4-4).
ACK.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org