[libvirt] [PATCH v2] virsh: Print error if specified bandwidth is invalid for blockjob

Osier Yang jyang at redhat.com
Mon Aug 22 11:16:02 UTC 2011


It's strange that the command fails but without any error if one
specifies as not a number.
---
 tools/virsh.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index ffb4ced..5eeaee6 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -5209,8 +5209,10 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
     if (vshCommandOptString(cmd, "path", &path) < 0)
         goto out;
 
-    if (vshCommandOptUL(cmd, "bandwidth", &bandwidth) < 0)
+    if (vshCommandOptUL(cmd, "bandwidth", &bandwidth) < 0) {
+        vshError(ctl, "%s", _("bandwidth must be a number"));
         goto out;
+    }
 
     if (mode == VSH_CMD_BLOCK_JOB_ABORT)
         ret = virDomainBlockJobAbort(dom, path, 0);
-- 
1.7.6




More information about the libvir-list mailing list