From de924ca90a0ff1ad8adeab460761f65b7a742d72 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 21 Jun 2012 18:34:32 +0200 Subject: [PATCH] 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. --- tools/virsh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh.c b/tools/virsh.c index 265857d700..035482269b 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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; }