[libvirt] [PATCH] virsh: add --pool support to vol-key command

Justin Clift justin at salasaga.org
Tue Jun 8 15:21:31 UTC 2010


---
 tools/virsh.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 2e8cbec..1e00114 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -5947,13 +5947,13 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
  * "vol-name" command
  */
 static const vshCmdInfo info_vol_name[] = {
-    {"help", N_("convert a vol UUID to vol name")},
+    {"help", N_("returns the volume name for a given volume key or path")},
     {"desc", ""},
     {NULL, NULL}
 };
 
 static const vshCmdOptDef opts_vol_name[] = {
-    {"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("vol key or path")},
+    {"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("volume key or path")},
     {NULL, 0, 0, NULL}
 };
 
@@ -5975,18 +5975,18 @@ cmdVolName(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[] = {
-    {"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("vol uuid")},
+    {"pool", VSH_OT_STRING, 0, N_("pool name or uuid")},
+    {"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("volume name or path")},
     {NULL, 0, 0, NULL}
 };
 
@@ -5994,12 +5994,12 @@ static int
 cmdVolKey(vshControl *ctl, const vshCmd *cmd)
 {
     virStorageVolPtr vol;
+    char *name = NULL;
 
     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", &name)))
         return FALSE;
 
     vshPrint(ctl, "%s\n", virStorageVolGetKey(vol));
@@ -6008,19 +6008,18 @@ cmdVolKey(vshControl *ctl, const vshCmd *cmd)
 }
 
 
-
 /*
  * "vol-path" command
  */
 static const vshCmdInfo info_vol_path[] = {
-    {"help", N_("convert a vol UUID to vol path")},
+    {"help", N_("returns the volume path for a given volume name or key")},
     {"desc", ""},
     {NULL, NULL}
 };
 
 static const vshCmdOptDef opts_vol_path[] = {
     {"pool", VSH_OT_STRING, 0, N_("pool name or uuid")},
-    {"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("vol name or key")},
+    {"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("volume name or key")},
     {NULL, 0, 0, NULL}
 };
 
-- 
1.7.0.1




More information about the libvir-list mailing list