diff --git a/lib/nova_plugins/functions-libvirt b/lib/nova_plugins/functions-libvirt index 56bb6bda1c..1ae049226a 100644 --- a/lib/nova_plugins/functions-libvirt +++ b/lib/nova_plugins/functions-libvirt @@ -20,8 +20,46 @@ set +o xtrace # extremely verbose.) DEBUG_LIBVIRT=$(trueorfalse True DEBUG_LIBVIRT) +# Try to enable coredumps for libvirt +# Currently fairly specific to OpenStackCI hosts +DEBUG_LIBVIRT_COREDUMPS=$(trueorfalse False DEBUG_LIBVIRT_COREDUMPS) + +# Only Xenial is left with libvirt-bin. Everywhere else is libvirtd +if is_ubuntu && [ ! -f /etc/init.d/libvirtd ]; then + LIBVIRT_DAEMON=libvirt-bin +else + LIBVIRT_DAEMON=libvirtd +fi + +# Enable coredumps for libvirt +# Bug: https://bugs.launchpad.net/nova/+bug/1643911 +function _enable_coredump { + local confdir=/etc/systemd/system/${LIBVIRT_DAEMON}.service.d + local conffile=${confdir}/coredump.conf + + # Create a coredump directory, and instruct the kernel to save to + # here + sudo mkdir -p /var/core + sudo chmod a+wrx /var/core + echo '/var/core/core.%e.%p.%h.%t' | \ + sudo tee /proc/sys/kernel/core_pattern + + # Drop a config file to up the core ulimit + sudo mkdir -p ${confdir} + sudo tee ${conffile} <