]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Fix vol-name and vol-pool commands
authorMatthias Bolte <matthias.bolte@googlemail.com>
Mon, 1 Aug 2011 12:42:06 +0000 (14:42 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Mon, 1 Aug 2011 13:27:55 +0000 (15:27 +0200)
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

index 9e0744d80d96a32e2304097091446d4730b9d1cc..5fcf370262613ef5b235fb47fa6f467ca72ebaa5 100644 (file)
@@ -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;
     }