mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
virsh: add pool support to vol-key command
Presently the vol-key command only supports being provided with a volume path. This patch adds support for providing it with a pool and volume identifier pair as well. virsh # vol-key --pool <pool-name-or-uuid> <vol-name-or-path>
This commit is contained in:
parent
08d42b52f1
commit
31495ef6a1
@ -6098,12 +6098,13 @@ cmdVolPool(vshControl *ctl, const vshCmd *cmd)
|
|||||||
* "vol-key" command
|
* "vol-key" command
|
||||||
*/
|
*/
|
||||||
static const vshCmdInfo info_vol_key[] = {
|
static const vshCmdInfo info_vol_key[] = {
|
||||||
{"help", N_("convert a vol UUID to vol key")},
|
{"help", N_("returns the volume key for a given volume name or path")},
|
||||||
{"desc", ""},
|
{"desc", ""},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_vol_key[] = {
|
static const vshCmdOptDef opts_vol_key[] = {
|
||||||
|
{"pool", VSH_OT_STRING, 0, N_("pool name or uuid")},
|
||||||
{"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("vol uuid")},
|
{"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("vol uuid")},
|
||||||
{NULL, 0, 0, NULL}
|
{NULL, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
@ -6116,8 +6117,7 @@ cmdVolKey(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", "pool", NULL,
|
if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
|
||||||
VSH_BYUUID)))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
vshPrint(ctl, "%s\n", virStorageVolGetKey(vol));
|
vshPrint(ctl, "%s\n", virStorageVolGetKey(vol));
|
||||||
|
@ -858,10 +858,11 @@ I<vol-name-or-key> is the name or key of the volume to return the path for.
|
|||||||
Return the name for a given volume.
|
Return the name for a given volume.
|
||||||
I<vol-key-or-path> is the key or path of the volume to return the name for.
|
I<vol-key-or-path> is the key or path of the volume to return the name for.
|
||||||
|
|
||||||
=item B<vol-key> I<vol-uuid>
|
=item B<vol-key> [optional I<--pool> I<pool-or-uuid>] I<vol-name-or-path>
|
||||||
|
|
||||||
Return the volume key for a given volume UUID.
|
Return the volume key for a given volume.
|
||||||
I<vol-uuid> is the UUID of the volume to return the volume key for.
|
I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume is in.
|
||||||
|
I<vol-name-or-path> is the name or path of the volume to return the volume key for.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user