[libvirt] [PATCH] Added --pool support to virsh vol-key, plus improved help descriptions for vol-key, vol-name, & vol-path.

Justin Clift justin at salasaga.org
Sun Jun 6 09:54:36 UTC 2010


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

diff --git a/tools/virsh.c b/tools/virsh.c
index 3ba549b..2ac6e73 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -5997,13 +5997,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}
  };
  @@ -6025,18 +6025,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}
  };
  @@ -6044,12 +6044,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));
@@ -6058,19 +6058,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