]> git.ipfire.org Git - thirdparty/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)
committerCole Robinson <crobinso@redhat.com>
Sun, 12 Aug 2012 22:35:34 +0000 (18:35 -0400)
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.
(cherry picked from commit de924ca90a0ff1ad8adeab460761f65b7a742d72)

tools/virsh.c

index 1828d19f2115a7c56b898ea27f73347229c433c1..8acc71a3c36c8367b8a47598674db1429adec0fb 100644 (file)
@@ -5507,7 +5507,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;
     }