mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemu: enable QEMU core dump by default on Linux
The Linux MADV_DONTDUMP flag was added to Linux kernels > 3.3, back in 2012, and the dump-guest-core flag was added to QEMU > 1.0 at the same time. IOW, on Linux we have long been able to assume that QEMU core dumps will exclude guest memory, unless the user has overridden the host level defaults in the domain XML. It is desirable to permit QEMU core dumps out of the box to make it easier for users to report crashes to their OS vendor without having to reconfigure and restart libvirt daemons and their running guests. While there is a risk that an admin may have set 'dump_guest_core' to true, while leaving 'max_core' to 0, on balance the benefits of easier troubleshooting outweigh the risk of changing the defaults to permit core dumps. Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
dd217cd938
commit
57835f432f
@ -709,7 +709,9 @@
|
||||
# As a special case it can be set to the string "unlimited" to
|
||||
# to allow arbitrarily sized core dumps.
|
||||
#
|
||||
# By default the core dump size is set to 0 disabling all dumps
|
||||
# By default the core dump size is set to unlimited on
|
||||
# Linux where 'dump_guest_core' defaults to false, and
|
||||
# is set to 0 on other platforms, disabling all dumps
|
||||
#
|
||||
# Size is a positive integer specifying bytes or the
|
||||
# string "unlimited"
|
||||
@ -717,8 +719,8 @@
|
||||
#max_core = "unlimited"
|
||||
|
||||
# Determine if guest RAM is included in QEMU core dumps. By
|
||||
# default guest RAM will be excluded if a new enough QEMU is
|
||||
# present and host kernel supports it. Setting this to '1' will
|
||||
# default guest RAM will be excluded on Linux platforms,
|
||||
# and included on all other patforms. Setting this to '1' will
|
||||
# force guest RAM to always be included in QEMU core dumps.
|
||||
#
|
||||
# This setting will be ignored if the guest XML has set the
|
||||
|
@ -291,10 +291,14 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
|
||||
cfg->deprecationBehavior = g_strdup("none");
|
||||
cfg->storageUseNbdkit = USE_NBDKIT_DEFAULT;
|
||||
|
||||
#ifndef MADV_DONTDUMP
|
||||
#ifdef MADV_DONTDUMP
|
||||
cfg->maxCore = ULLONG_MAX;
|
||||
#else
|
||||
/* QEMU uses Linux extensions to madvise() (MADV_DODUMP/MADV_DONTDUMP) to
|
||||
* include/exclude guest memory from core dump. These might be unavailable
|
||||
* on some systems. Provide sane default. */
|
||||
* include/exclude guest memory from core dump. On non-Linux systems
|
||||
* core dumps will unavoidably include all guest RAM, so toggle the
|
||||
* default to reflect this and warn the admin.
|
||||
*/
|
||||
VIR_INFO("Host kernel doesn't support MADV_DONTDUMP. Enabling dump_guest_core");
|
||||
cfg->dumpGuestCore = true;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user