From: Philipp Schuster <philipp.schuster(a)cyberus-technology.de>
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/415b14903e816aeb98d6f9c16fba0...
Signed-off-by: Philipp Schuster <philipp.schuster(a)cyberus-technology.de>
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
---
tools/virsh-pool.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index f9aad8ded0..4cd7b7ba0b 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -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;
--
2.48.1