Bug 1395658

Summary: Document "virsh dump --memory-only"+"--format" and "/usr/share/qemu-kvm/dump-guest-memory.py"
Product: Red Hat Enterprise Linux 7 Reporter: Jiri Herrmann <jherrman>
Component: doc-Virtualization_Deployment_and_Administration_GuideAssignee: Yehuda Zimmerman <yzimmerm>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: lersek, pneedle, rhel-docs
Target Milestone: rcKeywords: Documentation
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-29 17:11:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1425467    

Comment 2 Laszlo Ersek 2016-11-16 16:50:00 UTC
* As basis for documenting --format, I recommend the "virsh" manual:

> --format /string/ is used to specify the format of 'memory-only' dump, and
> /string/ can be one of them: /elf/, /kdump-zlib/ (kdump-compressed format with
> zlib-compressed), /kdump-lzo/ (kdump-compressed format with
> lzo-compressed), /kdump-snappy/ (kdump-compressed format with
> snappy-compressed).

* For documenting "dump-guest-memory.py", I recommend two sources as basis:

(1) The commit message of the patch that introduced the script:

  http://git.qemu.org/?p=qemu.git;a=commitdiff;h=3e16d14fd93c

(2) The current built-in help text from the script:

  http://git.qemu.org/?p=qemu.git;a=blob;f=scripts/dump-guest-memory.py

Namely:

> Extract guest vmcore from qemu process coredump.
> 
> The two required arguments are FILE and ARCH:
> FILE identifies the target file to write the guest vmcore to.
> ARCH specifies the architecture for which the core will be generated.
> 
> This GDB command reimplements the dump-guest-memory QMP command in
> python, using the representation of guest memory as captured in the qemu
> coredump. The qemu process that has been dumped must have had the
> command line option "-machine dump-guest-core=on" which is the default.
> 
> For simplicity, the "paging", "begin" and "end" parameters of the QMP
> command are not supported -- no attempt is made to get the guest's
> internal paging structures (ie. paging=false is hard-wired), and guest
> memory is always fully dumped.
> 
> Currently aarch64-be, aarch64-le, X86_64, 386, s390, ppc64-be,
> ppc64-le guests are supported.
> 
> The CORE/NT_PRSTATUS and QEMU notes (that is, the VCPUs' statuses) are
> not written to the vmcore. Preparing these would require context that is
> only present in the KVM host kernel module when the guest is alive. A
> fake ELF note is written instead, only to keep the ELF parser of "crash"
> happy.
> 
> Dependent on how busted the qemu process was at the time of the
> coredump, this command might produce unpredictable results. If qemu
> deliberately called abort(), or it was dumped in response to a signal at
> a halfway fortunate point, then its coredump should be in reasonable
> shape and this command should mostly work.

Thanks!