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

--- 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

On 06/06/2010 07:54 PM, Justin Clift wrote:
--- tools/virsh.c | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-)
This patch improves the help descriptions for vol-key, vol-name, and vol-path. From: vol-path convert a vol UUID to vol path vol-name convert a vol UUID to vol name vol-key convert a vol UUID to vol key To: vol-path returns the volume path for a given volume name or key vol-name returns the volume name for a given volume key or path vol-key returns the volume key for a given volume name or path Additionally, because the vol-key command didn't previously support being given a --pool <string> vol_name argument, this patch adds that too. As a bonus, it seems to address this existing Red Hat BZ #: https://bugzilla.redhat.com/show_bug.cgi?id=598365 Regards and best wishes, Justin Clift -- Salasaga - Open Source eLearning IDE http://www.salasaga.org
participants (1)
-
Justin Clift