]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: add pool support to vol-key command
authorJustin Clift <justin@salasaga.org>
Fri, 11 Jun 2010 11:51:55 +0000 (21:51 +1000)
committerEric Blake <eblake@redhat.com>
Wed, 16 Jun 2010 22:32:05 +0000 (16:32 -0600)
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>

tools/virsh.c
tools/virsh.pod

index 07f2a1e3e96a80ec002b92771da630b2b290bd91..6731a4a0d795ee752bf3d5ac51c1188297acb7a4 100644 (file)
@@ -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));
index b1917eed6e756fb226a36fdecd8384b600357559..bb2d49a830fe9379ff8854ce355ada1b241059bc 100644 (file)
@@ -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.
 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.
-I<vol-uuid> is the UUID of the volume to return the volume key for.
+Return the volume key for a given volume.
+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