]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: pool-list: remove unnecessary spaces to align behavior
authorPhilipp Schuster <philipp.schuster@cyberus-technology.de>
Wed, 8 Jan 2025 16:38:15 +0000 (17:38 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 29 Jan 2025 11:42:27 +0000 (12:42 +0100)
By removing the unnecessary spaces, the behavior is aligned with
`virsh list --all --name` and `virsh net-list --all --name`.

Without this change, one can't do something like the following easily:

`virsh pool-list --all --name | xargs -I {} virsh pool-start \"{}\"`

as no pool `"foo    "` (with all the spaces) actually exist.

Although the removed comment states that the additional spaces were kept
to maintain backwards compatibility, the commit [0] and the old behavior
are from 2010 when libvirt was at version 0.8.1. For the sake of sanity,
the behavior should be aligned with other parts of the CLI.

[0] https://gitlab.com/libvirt/libvirt/-/commit/415b14903e816aeb98d6f9c16fba045686cb0765

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tools/virsh-pool.c

index f9aad8ded06392152871534ed9007a12940221fc..4cd7b7ba0b020513900cbfc56f8c3ffc56ab0d52 100644 (file)
@@ -1270,11 +1270,6 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
         }
     }
 
-    /* If the --details option wasn't selected, we output the pool
-     * info using the fixed string format from previous versions to
-     * maintain backward compatibility.
-     */
-
     /* Output basic info then return if --details option not selected */
     if (!details) {
         if (uuid || name) {
@@ -1287,7 +1282,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
                 if (name) {
                     const char *name_str =
                         virStoragePoolGetName(list->pools[i]);
-                    vshPrint(ctl, "%-20s\n", name_str);
+                    vshPrint(ctl, "%s\n", name_str);
                 }
             }
             ret = true;