mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 10:52:22 +00:00
virsh: add --uuid option to vol-pool
Adds an optional switch, --uuid, for telling the virsh vol-pool command to return the pool UUID rather than pool name.
This commit is contained in:
parent
322b1fd44b
commit
2b39cd355a
@ -6084,6 +6084,7 @@ static const vshCmdInfo info_vol_pool[] = {
|
||||
};
|
||||
|
||||
static const vshCmdOptDef opts_vol_pool[] = {
|
||||
{"uuid", VSH_OT_BOOL, 0, N_("return the pool uuid rather than pool name")},
|
||||
{"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("volume key or path")},
|
||||
{NULL, 0, 0, NULL}
|
||||
};
|
||||
@ -6093,6 +6094,7 @@ cmdVolPool(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virStoragePoolPtr pool;
|
||||
virStorageVolPtr vol;
|
||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||
|
||||
/* Check the connection to libvirtd daemon is still working */
|
||||
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
||||
@ -6112,8 +6114,15 @@ cmdVolPool(vshControl *ctl, const vshCmd *cmd)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Return the name of the parent storage pool */
|
||||
vshPrint(ctl, "%s\n", virStoragePoolGetName(pool));
|
||||
/* Return the requested details of the parent storage pool */
|
||||
if (vshCommandOptBool(cmd, "uuid")) {
|
||||
/* Retrieve and return pool UUID string */
|
||||
if (virStoragePoolGetUUIDString(pool, &uuid[0]) == 0)
|
||||
vshPrint(ctl, "%s\n", uuid);
|
||||
} else {
|
||||
/* Return the storage pool name */
|
||||
vshPrint(ctl, "%s\n", virStoragePoolGetName(pool));
|
||||
}
|
||||
|
||||
/* Cleanup */
|
||||
virStorageVolFree(vol);
|
||||
|
@ -842,10 +842,12 @@ I<vol-name-or-key-or-path> is the name or key or path of the volume to return in
|
||||
Return the list of volumes in the given storage pool.
|
||||
I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool.
|
||||
|
||||
=item B<vol-pool> I<vol-key-or-path>
|
||||
=item B<vol-pool> [optional I<--uuid>] I<vol-key-or-path>
|
||||
|
||||
Return the pool for a given volume.
|
||||
I<vol-key-or-path> is the key or path of the volume to return the pool name for.
|
||||
Return the pool name or UUID for a given volume. By default, the pool name is
|
||||
returned. If the I<--uuid> option is given, the pool UUID is returned instead.
|
||||
I<vol-key-or-path> is the key or path of the volume to return the pool
|
||||
information for.
|
||||
|
||||
=item B<vol-path> [optional I<--pool> I<pool-or-uuid>] I<vol-name-or-key>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user