Bug 1981625 - virsh dump file format not correct when using "elf" or "kdump-zlib" format
Summary: virsh dump file format not correct when using "elf" or "kdump-zlib" format
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.5
Assignee: Peter Krempa
QA Contact: zhentang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-13 02:11 UTC by zhentang
Modified: 2021-11-16 08:52 UTC (History)
9 users (show)

Fixed In Version: libvirt-7.6.0-1.module+el8.5.0+12097+2c77910b
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 07:55:01 UTC
Type: Bug
Target Upstream Version: 7.6.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4684 0 None None None 2021-11-16 07:55:59 UTC

Description zhentang 2021-07-13 02:11:19 UTC
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:

Comment 1 Han Han 2021-07-13 08:05:11 UTC
One tiny patch to fix it: https://listman.redhat.com/archives/libvir-list/2021-July/msg00279.html

Comment 2 Peter Krempa 2021-07-13 09:27:59 UTC
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>

Comment 3 zhentang 2021-07-20 07:01:21 UTC
Tested on v7.5.0-128-g8ad2882cb6 and it works as expected

Comment 6 zhentang 2021-08-09 09:56:21 UTC
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

Comment 8 errata-xmlrpc 2021-11-16 07:55:01 UTC
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


Note You need to log in before you can comment on or make changes to this bug.