[libvirt] [PATCH] virsh: Improve error when trying to change vm's cpu count 0

Peter Krempa pkrempa at redhat.com
Thu Jun 21 16:36:58 UTC 2012


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 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 55cbe2b..2ec84cd 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -5755,7 +5755,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;
     }
-- 
1.7.8.6




More information about the libvir-list mailing list