From 31495ef6a1308109b10ffa17e94eb550f716f14c Mon Sep 17 00:00:00 2001 From: Justin Clift Date: Fri, 11 Jun 2010 21:51:55 +1000 Subject: [PATCH] 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 --- tools/virsh.c | 6 +++--- tools/virsh.pod | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 07f2a1e3e9..6731a4a0d7 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -6098,12 +6098,13 @@ cmdVolPool(vshControl *ctl, const vshCmd *cmd) * "vol-key" command */ 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", ""}, {NULL, NULL} }; 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")}, {NULL, 0, 0, NULL} }; @@ -6116,8 +6117,7 @@ cmdVolKey(vshControl *ctl, const vshCmd *cmd) if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) return FALSE; - if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", "pool", NULL, - VSH_BYUUID))) + if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL))) return FALSE; vshPrint(ctl, "%s\n", virStorageVolGetKey(vol)); diff --git a/tools/virsh.pod b/tools/virsh.pod index b1917eed6e..bb2d49a830 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -858,10 +858,11 @@ I is the name or key of the volume to return the path for. Return the name for a given volume. I is the key or path of the volume to return the name for. -=item B I +=item B [optional I<--pool> I] I -Return the volume key for a given volume UUID. -I is the UUID of the volume to return the volume key for. +Return the volume key for a given volume. +I<--pool> I is the name or UUID of the storage pool the volume is in. +I is the name or path of the volume to return the volume key for. =back -- 2.39.5