From: Peter Krempa Date: Thu, 21 Jun 2012 16:34:32 +0000 (+0200) Subject: virsh: Improve error when trying to change vm's cpu count 0 X-Git-Tag: v0.9.11.5~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cba21fd98d0cac0d3c5b5099abe868ee6af93c88;p=thirdparty%2Flibvirt.git virsh: Improve error when trying to change vm's cpu count 0 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) --- diff --git a/tools/virsh.c b/tools/virsh.c index 1828d19f21..8acc71a3c3 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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; }