]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Improve error when trying to change vm's cpu count 0
authorPeter Krempa <pkrempa@redhat.com>
Thu, 21 Jun 2012 16:34:32 +0000 (18:34 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 22 Jun 2012 08:24:17 +0000 (10:24 +0200)
This patch adds a check for the count of processors the user requests
for the guest machine so that invalid values produce a more helpful
error message.

tools/virsh.c

index 265857d700d84fb72336c94875ee3209a38e7285..035482269b59213e9f507b9d2dc909489f3000f3 100644 (file)
@@ -5752,7 +5752,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
     if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
         return false;
 
-    if (vshCommandOptInt(cmd, "count", &count) < 0) {
+    if (vshCommandOptInt(cmd, "count", &count) < 0 || count <= 0) {
         vshError(ctl, "%s", _("Invalid number of virtual CPUs"));
         goto cleanup;
     }