Description of problem: When using '#virsh dump' command with '--format' , the format of core dump file is not correct Using 'elf', the format of the file created is 'DATA' Using 'kdump-zlib', the file format is 'ELF' Version-Release number of selected component (if applicable): Name : libvirt Version : 7.5.0 Release : 1.module+el8.5.0+11664+59f87560 Architecture : x86_64 Name : qemu-kvm Epoch : 15 Version : 6.0.0 Release : 21.module+el8.5.0+11555+e0ab0d09 Architecture : x86_64 How reproducible: 100% Steps to Reproduce: 1. start a vm # virsh list Id Name State -------------------------------- 1 avocado-vt-vm1 running 2. dump guest with kdump-zlib format # virsh dump avocado-vt-vm1 --memory-only --format kdump-zlib /var/tmp/vm.core2 Domain 'avocado-vt-vm1' dumped to /var/tmp/vm.core2 # file vm.core2 vm.core2: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style 3. dump guest with elf format # virsh dump avocado-vt-vm1 --memory-only --format elf /var/tmp/vm.core2 Domain 'avocado-vt-vm1' dumped to /var/tmp/vm.core2 # file vm.core2 vm.core2: data Actual results: Using 'elf', the format of the file created is 'DATA' Using 'kdump-zlib', the file format is 'ELF' Expected results: using 'elf' format the dump file format should be ELF using 'kdump-zlib' format, the dump file format should be data Additional info:
One tiny patch to fix it: https://listman.redhat.com/archives/libvir-list/2021-July/msg00279.html
Fixed upstream: commit 78b1a53df13e2acff872327da933be9fa2c0d069 Author: Han Han <hhan> Date: Tue Jul 13 16:04:12 2021 +0800 virsh: Fix the order of format arguments in doDump According to definition of virDomainCoreDumpFormat, the "elf" should be the first argument in VIR_ENUM_*. Fixes: 84cc4543be Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1981625 Signed-off-by: Han Han <hhan> Reviewed-by: Peter Krempa <pkrempa>
Tested on v7.5.0-128-g8ad2882cb6 and it works as expected
Verified libvirt-7.6.0-1.scrmod+el8.5.0+12133+c45b5bc2 -------------------------------------------------------------------- [root@zhetang-rhel8 x86_64]# virsh dump rhel9.0 --memory-only --format elf /tmp/elf-vm Domain 'rhel9.0' dumped to /tmp/elf-vm [root@zhetang-rhel8 x86_64]# file /tmp/elf-vm /tmp/elf-vm: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style [root@zhetang-rhel8 x86_64]# virsh dump rhel9.0 --memory-only --format kdump-zlib /tmp/kdump-vm Domain 'rhel9.0' dumped to /tmp/kdump-vm [root@zhetang-rhel8 x86_64]# file /tmp/kdump-vm /tmp/kdump-vm: data
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:4684