[libvirt] [PATCH] virsh: Fix vol-name and vol-pool commands

This commands don't have a --pool option, so don't tell vshCommandOptVolBy that there could be one. This made vshCommandOptString for pooloptname fail and an "missing option" error was reported. Make pooloptname optional for vshCommandOptVolBy. --- tools/virsh.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 9e0744d..5fcf370 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -9201,7 +9201,7 @@ cmdVolName(vshControl *ctl, const vshCmd *cmd) if (!vshConnectionUsability(ctl, ctl->conn)) return false; - if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", "pool", NULL, + if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", NULL, NULL, VSH_BYUUID))) return false; @@ -9238,7 +9238,7 @@ cmdVolPool(vshControl *ctl, const vshCmd *cmd) return false; /* Use the supplied string to locate the volume */ - if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", "pool", NULL, + if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", NULL, NULL, VSH_BYUUID))) { return false; } @@ -13619,7 +13619,7 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, if (vshCommandOptString(cmd, optname, &n) <= 0) return NULL; - if (vshCommandOptString(cmd, pooloptname, &p) < 0) { + if (pooloptname != NULL && vshCommandOptString(cmd, pooloptname, &p) < 0) { vshError(ctl, "%s", _("missing option")); return NULL; } -- 1.7.4.1

On Mon, Aug 01, 2011 at 02:43:25PM +0200, Matthias Bolte wrote:
This commands don't have a --pool option, so don't tell vshCommandOptVolBy that there could be one. This made vshCommandOptString for pooloptname fail and an "missing option" error was reported.
Make pooloptname optional for vshCommandOptVolBy.
oops replied privately, ACK thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

2011/8/1 Daniel Veillard <veillard@redhat.com>:
On Mon, Aug 01, 2011 at 02:43:25PM +0200, Matthias Bolte wrote:
This commands don't have a --pool option, so don't tell vshCommandOptVolBy that there could be one. This made vshCommandOptString for pooloptname fail and an "missing option" error was reported.
Make pooloptname optional for vshCommandOptVolBy.
oops replied privately,
ACK
thanks !
Daniel
Pushed, now. -- Matthias Bolte http://photron.blogspot.com
participants (2)
-
Daniel Veillard
-
Matthias Bolte