On 04/22/2011 03:57 AM, Jiri Denemark wrote:
> This patch makes the options "--crash" and
"--live" of "virsh dump" mutually exclusive
Moreover, this would only protect virsh. It's better to have this check in
virDomainCoreDump() so that all users can get the error.
Agreed.
The following patch should fix these issues.
Subject: [PATCH] Make crash and live flags mutually exclusive in
virDomainCoreDump
Mail-Followup-To: libvir-list(a)redhat.com
They don't make any sense when used together.
---
src/libvirt.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 10c3cdf..2d56b77 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2379,6 +2379,12 @@ virDomainCoreDump(virDomainPtr domain, const char *to, int flags)
goto error;
}
+ if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_LIVE)) {
+ virLibDomainError(VIR_ERR_INVALID_ARG,
+ _("crash and live flags are mutually exclusive"));
ACK, but incomplete. A few lines earlier, the documentation states:
* @flags: extra flags, currently unused
*
* This method will dump the core of a domain on a given file for analysis.
It would be a wise time to update the docs at the same time :)
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org