[libvirt] [PATCH 4/7] virsh-host: Adapt to new error reporting

Michal Privoznik mprivozn at redhat.com
Wed Apr 2 12:43:57 UTC 2014


Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tools/virsh-host.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index cac6086..107aec5 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -111,10 +111,8 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
 
     VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
 
-    if (cellno && vshCommandOptInt(cmd, "cellno", &cell) < 0) {
-        vshError(ctl, "%s", _("cell number has to be a number"));
+    if (cellno && vshCommandOptInt(cmd, "cellno", &cell) < 0)
         return false;
-    }
 
     if (all) {
         if (!(cap_xml = virConnectGetCapabilities(ctl->conn))) {
@@ -372,10 +370,8 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
     unsigned long long cpu_stats[VSH_CPU_LAST] = { 0 };
     bool present[VSH_CPU_LAST] = { false };
 
-    if (vshCommandOptInt(cmd, "cpu", &cpuNum) < 0) {
-        vshError(ctl, "%s", _("Invalid value of cpuNum"));
+    if (vshCommandOptInt(cmd, "cpu", &cpuNum) < 0)
         return false;
-    }
 
     if (virNodeGetCPUStats(ctl->conn, cpuNum, NULL, &nparams, 0) != 0) {
         vshError(ctl, "%s",
@@ -481,10 +477,8 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd)
     virNodeMemoryStatsPtr params = NULL;
     bool ret = false;
 
-    if (vshCommandOptInt(cmd, "cell", &cellNum) < 0) {
-        vshError(ctl, "%s", _("Invalid value of cellNum"));
+    if (vshCommandOptInt(cmd, "cell", &cellNum) < 0)
         return false;
-    }
 
     /* get the number of memory parameters */
     if (virNodeGetMemoryStats(ctl->conn, cellNum, NULL, &nparams, 0) != 0) {
@@ -555,10 +549,8 @@ cmdNodeSuspend(vshControl *ctl, const vshCmd *cmd)
     if (vshCommandOptStringReq(ctl, cmd, "target", &target) < 0)
         return false;
 
-    if (vshCommandOptLongLong(cmd, "duration", &duration) < 0) {
-        vshError(ctl, _("Invalid duration argument"));
+    if (vshCommandOptLongLong(cmd, "duration", &duration) < 0)
         return false;
-    }
 
     if (STREQ(target, "mem"))
         suspendTarget = VIR_NODE_SUSPEND_TARGET_MEM;
@@ -863,7 +855,6 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
     size_t i;
 
     if ((rc = vshCommandOptUInt(cmd, "shm-pages-to-scan", &value)) < 0) {
-        vshError(ctl, "%s", _("invalid shm-pages-to-scan number"));
         goto cleanup;
     } else if (rc > 0) {
         if (virTypedParamsAddUInt(&params, &nparams, &maxparams,
@@ -873,7 +864,6 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
     }
 
     if ((rc = vshCommandOptUInt(cmd, "shm-sleep-millisecs", &value)) < 0) {
-        vshError(ctl, "%s", _("invalid shm-sleep-millisecs number"));
         goto cleanup;
     } else if (rc > 0) {
         if (virTypedParamsAddUInt(&params, &nparams, &maxparams,
@@ -883,7 +873,6 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
     }
 
     if ((rc = vshCommandOptUInt(cmd, "shm-merge-across-nodes", &value)) < 0) {
-        vshError(ctl, "%s", _("invalid shm-merge-across-nodes number"));
         goto cleanup;
     } else if (rc > 0) {
         if (virTypedParamsAddUInt(&params, &nparams, &maxparams,
-- 
1.9.0




More information about the libvir-list mailing list