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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to