mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virsh: pool-list: allow both --uuid and --name in one cmd
This patch will allow --uuid and --name in one cmd. The pool's UUID and name will be printed side by side. Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
This commit is contained in:
parent
0d9bcd6ffa
commit
b5817855c0
@ -1316,21 +1316,19 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|||||||
|
|
||||||
/* Output basic info then return if --details option not selected */
|
/* Output basic info then return if --details option not selected */
|
||||||
if (!details) {
|
if (!details) {
|
||||||
if (uuid) {
|
if (uuid || name) {
|
||||||
for (i = 0; i < list->npools; i++) {
|
for (i = 0; i < list->npools; i++) {
|
||||||
|
if (uuid) {
|
||||||
char uuid_str[VIR_UUID_STRING_BUFLEN];
|
char uuid_str[VIR_UUID_STRING_BUFLEN];
|
||||||
virStoragePoolGetUUIDString(list->pools[i], uuid_str);
|
virStoragePoolGetUUIDString(list->pools[i], uuid_str);
|
||||||
vshPrint(ctl, "%-36s\n", uuid_str);
|
vshPrint(ctl, "%-36s%c", uuid_str, name ? ' ': '\n');
|
||||||
}
|
}
|
||||||
ret = true;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
for (i = 0; i < list->npools; i++) {
|
const char *name_str =
|
||||||
const char *name_str = virStoragePoolGetName(list->pools[i]);
|
virStoragePoolGetName(list->pools[i]);
|
||||||
vshPrint(ctl, "%-20s\n", name_str);
|
vshPrint(ctl, "%-20s\n", name_str);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ret = true;
|
ret = true;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -3632,7 +3632,10 @@ In addition, there are several sets of filtering flags. I<--persistent> is to
|
|||||||
list the persistent pools, I<--transient> is to list the transient pools.
|
list the persistent pools, I<--transient> is to list the transient pools.
|
||||||
I<--autostart> lists the autostarting pools, I<--no-autostart> lists the pools
|
I<--autostart> lists the autostarting pools, I<--no-autostart> lists the pools
|
||||||
with autostarting disabled. If I<--uuid> is specified only pool's UUIDs are printed.
|
with autostarting disabled. If I<--uuid> is specified only pool's UUIDs are printed.
|
||||||
If I<--name> is specified only pool's names are printed.
|
If I<--name> is specified only pool's names are printed. If both I<--name>
|
||||||
|
and I<--uuid> are specified, pool's UUID and names are printed side by side
|
||||||
|
without any header. Options I<--uuid> and I<--name> are mutually exclusive
|
||||||
|
if option I<--details> is specified.
|
||||||
|
|
||||||
You may also want to list pools with specified types using I<type>, the
|
You may also want to list pools with specified types using I<type>, the
|
||||||
pool types must be separated by comma, e.g. --type dir,disk. The valid pool
|
pool types must be separated by comma, e.g. --type dir,disk. The valid pool
|
||||||
|
Loading…
Reference in New Issue
Block a user