[libvirt] [PATCH] virsh: remove embedded space from pool-list --details output

This removes the embedded space in the output of the pool-list --details command, as per the comments from Richard W. M. Jones. Scripting should now be able to parse this output in a reliable manner. --- New output: virsh # pool-list --details Name State Autostart Persistent Capacity Allocation Available -------------------------------------------------------------------------- default running yes yes 19.69GB 16.03GB 3.66GB image_dir running yes yes 1.79TB 1.59TB 203.68GB tmp running no yes 19.69GB 16.03GB 3.66GB virsh # tools/virsh.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 825e0d2..0dff211 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -5056,7 +5056,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) /* Create the capacity output string */ val = prettyCapacity(info.capacity, &unit); ret = virAsprintf(&poolInfoTexts[i].capacity, - "%.2lf %s", val, unit); + "%.2lf%s", val, unit); if (ret < 0) { /* An error occurred creating the string, return */ goto asprintf_failure; @@ -5065,7 +5065,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) /* Create the allocation output string */ val = prettyCapacity(info.allocation, &unit); ret = virAsprintf(&poolInfoTexts[i].allocation, - "%.2lf %s", val, unit); + "%.2lf%s", val, unit); if (ret < 0) { /* An error occurred creating the string, return */ goto asprintf_failure; @@ -5074,7 +5074,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) /* Create the available space output string */ val = prettyCapacity(info.available, &unit); ret = virAsprintf(&poolInfoTexts[i].available, - "%.2lf %s", val, unit); + "%.2lf%s", val, unit); if (ret < 0) { /* An error occurred creating the string, return */ goto asprintf_failure; -- 1.7.1

On Sat, Jul 03, 2010 at 06:44:06AM +1000, Justin Clift wrote:
This removes the embedded space in the output of the pool-list --details command, as per the comments from Richard W. M. Jones.
Scripting should now be able to parse this output in a reliable manner.
---
New output:
virsh # pool-list --details Name State Autostart Persistent Capacity Allocation Available -------------------------------------------------------------------------- default running yes yes 19.69GB 16.03GB 3.66GB image_dir running yes yes 1.79TB 1.59TB 203.68GB tmp running no yes 19.69GB 16.03GB 3.66GB
NACK, this is unpleasant to read without the spacing. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On 07/05/2010 07:45 PM, Daniel P. Berrange wrote: <snip>
New output:
virsh # pool-list --details Name State Autostart Persistent Capacity Allocation Available -------------------------------------------------------------------------- default running yes yes 19.69GB 16.03GB 3.66GB image_dir running yes yes 1.79TB 1.59TB 203.68GB tmp running no yes 19.69GB 16.03GB 3.66GB
NACK, this is unpleasant to read without the spacing.
Yeah, not stressed. I'll need to adjust the vol-list --details patch too, as that has no space separating the quantity and unit type in the output. Regards and best wishes, Justin Clift
Daniel
-- Salasaga - Open Source eLearning IDE http://www.salasaga.org
participants (2)
-
Daniel P. Berrange
-
Justin Clift