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 | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index d58b827..ebda248 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -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 suspend target argument"));
return false;
+ }
- if (vshCommandOptLongLong(cmd, "duration", &duration) < 0)
+ if (vshCommandOptLongLong(cmd, "duration", &duration) < 0) {
+ vshError(ctl, _("Invalid suspend duration argument"));
return false;
+ }
- if (vshCommandOptUInt(cmd, "flags", &flags) < 0)
+ if (vshCommandOptUInt(cmd, "flags", &flags) < 0) {
+ vshError(ctl, _("Invalid suspend flags argument"));
return false;
+ }
if (STREQ(target, "mem"))
suspendTarget = VIR_NODE_SUSPEND_TARGET_MEM;
--
1.7.3.4