]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Print error message if argument parsing fails for cmdNodesuspend
authorPeter Krempa <pkrempa@redhat.com>
Tue, 13 Dec 2011 13:50:30 +0000 (14:50 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 13 Dec 2011 14:36:50 +0000 (15:36 +0100)
If parsing of arguments failed, virsh did silently exit returning and
error state, but not specifying the possible problem.

 * tools/virsh: cmdNodesuspend: - error handling added

tools/virsh.c

index d58b82771fe975ea9d20b3fcca337f4985b2769f..a95784d0849b2983f6d065f77218e728d620a07d 100644 (file)
@@ -5270,14 +5270,20 @@ cmdNodeSuspend(vshControl *ctl, const vshCmd *cmd)
     if (!vshConnectionUsability(ctl, ctl->conn))
         return false;
 
-    if (vshCommandOptString(cmd, "target", &target) < 0)
+    if (vshCommandOptString(cmd, "target", &target) < 0) {
+        vshError(ctl, _("Invalid target argument"));
         return false;
+    }
 
-    if (vshCommandOptLongLong(cmd, "duration", &duration) < 0)
+    if (vshCommandOptLongLong(cmd, "duration", &duration) < 0) {
+        vshError(ctl, _("Invalid duration argument"));
         return false;
+    }
 
-    if (vshCommandOptUInt(cmd, "flags", &flags) < 0)
+    if (vshCommandOptUInt(cmd, "flags", &flags) < 0) {
+        vshError(ctl, _("Invalid flags argument"));
         return false;
+    }
 
     if (STREQ(target, "mem"))
         suspendTarget = VIR_NODE_SUSPEND_TARGET_MEM;