mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
qemu: Provide sane default for dump_guest_core
QEMU uses Linux extensions to madvise() to include/exclude guest memory from core dump. These are obviously not available everywhere. Currently, users have two options: 1) configure <memory dumpCore=''/> in domain XML, or 2) configure dump_guest_core in qemu.conf While these work, they may harm user experience as "things just don't work" out of the box. Provide sane default in virQEMUDriverConfigNew() so neither of two options is required. To have predictable results in tests, explicitly set cfg->dumpGuestCore to false in qemuTestDriverInit() (which creates cfg object for tests). Resolves: https://gitlab.com/libvirt/libvirt/-/issues/679 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
18b61cb4f9
commit
6126f743b1
@ -676,6 +676,7 @@ headers = [
|
||||
'sched.h',
|
||||
'sys/auxv.h',
|
||||
'sys/ioctl.h',
|
||||
'sys/mman.h',
|
||||
'sys/mount.h',
|
||||
'sys/syscall.h',
|
||||
'sys/ucred.h',
|
||||
|
@ -710,8 +710,8 @@
|
||||
|
||||
# Determine if guest RAM is included in QEMU core dumps. By
|
||||
# default guest RAM will be excluded if a new enough QEMU is
|
||||
# present. Setting this to '1' will force guest RAM to always
|
||||
# be included in QEMU core dumps.
|
||||
# present and host kernel supports it. 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
|
||||
# dumpCore attribute on the <memory> element.
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef WITH_SYS_MMAN_H
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include "virerror.h"
|
||||
#include "qemu_conf.h"
|
||||
#include "qemu_capabilities.h"
|
||||
@ -287,6 +291,14 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
|
||||
cfg->deprecationBehavior = g_strdup("none");
|
||||
cfg->storageUseNbdkit = USE_NBDKIT_DEFAULT;
|
||||
|
||||
#ifndef MADV_DONTDUMP
|
||||
/* 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. */
|
||||
VIR_INFO("Host kernel doesn't support MADV_DONTDUMP. Enabling dump_guest_core");
|
||||
cfg->dumpGuestCore = true;
|
||||
#endif
|
||||
|
||||
return g_steal_pointer(&cfg);
|
||||
}
|
||||
|
||||
|
@ -407,6 +407,8 @@ int qemuTestDriverInit(virQEMUDriver *driver)
|
||||
cfg->hugetlbfs[0].deflt = true;
|
||||
cfg->hugetlbfs[1].size = 1048576;
|
||||
|
||||
cfg->dumpGuestCore = false;
|
||||
|
||||
driver->privileged = true;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user