Auto-triggered dumps (on_crash, watchdog) always use QEMU's elf
default, which is not WinDbg-loadable for a Windows guest and cannot
be reliably converted after the fact.

This was proposed before as a per-domain XML knob
(https://www.mail-archive.com/[email protected]/msg09638.html).
Daniel P. Berrange objected: QEMU's query-dump-guest-memory-capability
reported win-dmp as available on any x86-64 guest regardless of
whether it had actually published a Windows dump header, so trusting
it was not safe. QEMU's win_dump_available() has since been fixed to
check the guest's vmcoreinfo note
(https://lore.kernel.org/qemu-devel/[email protected]/,
commit b4bdad7dce). Patch 1 queries it directly instead of adding an
XML knob.

Patch 4 adds a quota (auto_dump_max_size): a guest that keeps
crashing otherwise fills auto_dump_path one dump at a time. Oldest
dumps are pruned after each new one; the dump just written is never
removed, even alone over quota. Patches 2-3 give that setting and
virtlogd's max_size a "10GiB"-style syntax instead of a raw byte
count, reusing virScaleInteger()'s existing unit table.

Validated against real guests: a Windows Server 2022 guest crashed
via Sysinternals NotMyFault produces a PAGEDU64 (win-dmp) dump; an
AlmaLinux 9 guest crashed via sysrq produces an ELF one. A 1GiB quota
across two Linux crashes pruned the older dump and kept the newer,
over-quota one. syntax-check and virstringtest pass.

Denis V. Lunev (4):
  qemu: auto-select win-dmp for crash- and watchdog-triggered dumps
  util: add virStrToBytes() and virConfGetValueBytes() for scaled sizes
  logging: accept a unit suffix in virtlogd's max_size
  qemu: cap total size of auto-triggered dumps under auto_dump_path

 src/libvirt_private.syms        |   2 +
 src/logging/log_daemon_config.c |   2 +-
 src/logging/log_daemon_config.h |   2 +-
 src/logging/virtlogd.conf       |   7 +-
 src/qemu/qemu.conf.in           |  16 ++++
 src/qemu/qemu_conf.c            |   2 +
 src/qemu/qemu_conf.h            |   1 +
 src/qemu/qemu_driver.c          | 127 +++++++++++++++++++++++++++++++-
 src/util/virconf.c              |  47 ++++++++++++
 src/util/virconf.h              |   3 +
 src/util/virutil.c              |  23 ++++++
 src/util/virutil.h              |   5 ++
 tests/virstringtest.c           |  76 +++++++++++++++++++
 13 files changed, 308 insertions(+), 5 deletions(-)

-- 
2.53.0

Reply via email to