This patch makes the options "--crash" and "--live" of "virsh
dump" mutually exclusive
diff --git a/tools/virsh.c b/tools/virsh.c
index 2e35021..ef77d7f 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1869,14 +1869,19 @@ cmdDump(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DUMP_LIVE;
if (vshCommandOptBool (cmd, "crash"))
flags |= VIR_DUMP_CRASH;
-
+ if ((flags& VIR_DUMP_CRASH)&& (flags& VIR_DUMP_CRASH)) {
+ vshError(ctl, "%s", _("--crash and --live are mutually exclusive.
"
+ "Please choose only one."));
+ ret = FALSE;
+ goto cleanup;
+ }
if (virDomainCoreDump(dom, to, flags) == 0) {
vshPrint(ctl, _("Domain %s dumped to %s\n"), name, to);
} else {
vshError(ctl, _("Failed to core dump domain %s to %s"), name, to);
ret = FALSE;
}
-
+cleanup:
virDomainFree(dom);
return ret;
}