[PATCH] Make the options "--crash" and "--live" of "virsh dump" mutually exclusive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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;
 }

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]