libvirt
Whenever a VM crashes, it is useful to collect a core dump of the VM memory for debugging and analysis. For physical machines, Kexec and Kdump takes care of collecting crash dumps. For virtual machines, it depends whether the guest is fully virtualized (FV) or paravirtualized (PV).
To view crash dumps for FV machines, use the same procedures as for physical machines—Kexec and Kdump.
Unlike with FVs, Kexec/Kdump does not work in paravirtualized machines.
Crash dumps of PV guests must be performed by the host tool stack. If using
the xl
tool stack for Xen domUs, the xl
dump-core
command will produce the dump. For libvirt
-based
VM Guests, the virsh dump
command provides the same
functionality.
You can configure automatic collection of a core dump with the
on_crash
setting in the configuration of the VM Guest.
This setting tells the host tool stack what to do if the VM Guest
encounters a crash. The default in both xl
and libvirt
is destroy
. Useful options for automatically collecting a
core dump are coredump-destroy
and
coredump-restart
.
The difference between fully virtualized and paravirtualized virtual machines is described in Section 1.4, “Virtualization Modes”.
Detailed information about Kexec/Kdump mechanism is included in Chapter 17, Kexec and Kdump.
Refer to the xl.cfg manual page (man 5 xl.cfg
) for more
information on the xl
configuration syntax.
Refer to https://libvirt.org/formatdomain.html#events-configuration for
details about the libvirt
XML settings.