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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/22/12 09:25, Martin Kletzander wrote:
On 06/21/2012 06:36 PM, Peter Krempa wrote:
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;
      }


This gets checked in the driver, but one more check here means no
pointless connection and better error message, so ACK,



It is checked in the API handler, but the message is a little bit more explanatory:

before:
error: nvcpus in virDomainSetVcpus must not be zero

after applied:
error: Invalid number of virtual CPUs

Pushed; Thanks for review.

Peter

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]