mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
virsh-volume: Unify alignment of vol-list output columns
Add an extra space before the first column as we have when listing domains. Previous output: $ virsh vol-list glusterpool Name Path ----------------------------------------- asdf gluster://gluster-node-1/gv0/asdf c gluster://gluster-node-1/gv0/c cd gluster://gluster-node-1/gv0/cd $ virsh vol-list glusterpool --details Name Path Type Capacity Allocation ---------------------------------------------------------------------- asdf gluster://gluster-node-1/gv0/asdf unknown 0.00 B 0.00 B c gluster://gluster-node-1/gv0/c unknown 16.00 B 16.00 B cd gluster://gluster-node-1/gv0/cd unknown 0.00 B 0.00 B New output: $ virsh vol-list glusterpool Name Path ------------------------------------------------------------------------------ asdf gluster://gluster-node-1/gv0/asdf c gluster://gluster-node-1/gv0/c cd gluster://gluster-node-1/gv0/cd $ virsh vol-list glusterpool --details Name Path Type Capacity Allocation ------------------------------------------------------------------------ asdf gluster://gluster-node-1/gv0/asdf unknown 0.00 B 0.00 B c gluster://gluster-node-1/gv0/c unknown 16.00 B 16.00 B cd gluster://gluster-node-1/gv0/cd unknown 0.00 B 0.00 B
This commit is contained in:
parent
7f2b173feb
commit
d6fdcb88b9
@ -1450,10 +1450,11 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
||||
/* Output basic info then return if --details option not selected */
|
||||
if (!details) {
|
||||
/* The old output format */
|
||||
vshPrintExtra(ctl, "%-20s %-40s\n", _("Name"), _("Path"));
|
||||
vshPrintExtra(ctl, "-----------------------------------------\n");
|
||||
vshPrintExtra(ctl, " %-20s %-40s\n", _("Name"), _("Path"));
|
||||
vshPrintExtra(ctl, "---------------------------------------"
|
||||
"---------------------------------------\n");
|
||||
for (i = 0; i < list->nvols; i++) {
|
||||
vshPrint(ctl, "%-20s %-40s\n", virStorageVolGetName(list->vols[i]),
|
||||
vshPrint(ctl, " %-20s %-40s\n", virStorageVolGetName(list->vols[i]),
|
||||
volInfoTexts[i].path);
|
||||
}
|
||||
|
||||
@ -1503,7 +1504,7 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
||||
|
||||
/* Create the output template */
|
||||
ret = virAsprintf(&outputStr,
|
||||
"%%-%lus %%-%lus %%-%lus %%%lus %%%lus\n",
|
||||
" %%-%lus %%-%lus %%-%lus %%%lus %%%lus\n",
|
||||
(unsigned long) nameStrLength,
|
||||
(unsigned long) pathStrLength,
|
||||
(unsigned long) typeStrLength,
|
||||
@ -1519,7 +1520,7 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
||||
("Capacity"), _("Allocation"));
|
||||
for (i = nameStrLength + pathStrLength + typeStrLength
|
||||
+ capStrLength + allocStrLength
|
||||
+ 8; i > 0; i--)
|
||||
+ 10; i > 0; i--)
|
||||
vshPrintExtra(ctl, "-");
|
||||
vshPrintExtra(ctl, "\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user