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

Eric Blake eblake at redhat.com
Fri Apr 22 15:57:46 UTC 2011


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 at 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 at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110422/010a4ffd/attachment-0001.sig>


More information about the libvir-list mailing list