Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save archerslaw/170726833ec01257bbee to your computer and use it in GitHub Desktop.
Save archerslaw/170726833ec01257bbee to your computer and use it in GitHub Desktop.
[dump][pv dump] QEMU add pvpanic device to deal with guest panic event for automatic capturing
1.boot guest with pvpanic device and QMP monitor.
# /usr/libexec/qemu-kvm -M pc-i440fx-rhel7.0.0 ... -qmp tcp:0:4444,server,nowait -serial unix:/tmp/ttyS0,server,nowait -spice port=5931,disable-ticketing -monitor stdio -device pvpanic
Note: There's a new RHEL-7 qemu-kvm bug that affects this test case: bug 990601. Once that bug is fixed, you'll have to replace ‘-global pvpanic.ioport=0x0505’ in step 1 with ‘-device pvpanic’
$ telnet 10.66.9.242 4444
{"execute":"qmp_capabilities"}
{"return": {}}
2.check the info qtree to contain the dump the device 'pvpanic' and ioport.
(qemu) info qtree
3.check the HMP monitor status
(qemu) info status
4.trace the new QEVENT_GUEST_PANICKED event by QMP.
# echo c >/proc/sysrq-trigger
5.powerdown guest and edit a virsh-dump configure file.
# virsh edit virsh-dump
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>-->first line
...
<on_crash>coredump-destroy</on_crash>
...
</devices>
<qemu:commandline>-->add the device in the end of XML
<qemu:arg value='-device'/>
<qemu:arg value='pvpanic'/>
</qemu:commandline>
</domain>
6.boot up guest via virt-manager.
# virsh qemu-monitor-command dump-test --hmp info qtree
...
dev: pvpanic, id ""
ioport = 1285
...
7.Trigger guest coredump # echo c >/proc/sysrq-trigger.
(qemu) info status
VM status: paused (guest-panicked)
{"timestamp": {"seconds": 1372915708, "microseconds": 380634}, "event": "GUEST_PANICKED", "data": {"action": "pause"}}
{"timestamp": {"seconds": 1372915708, "microseconds": 473067}, "event": "STOP"}
8.Check the crash file automatically created in host.
# ls -lh /var/lib/libvirt/qemu/dump/virsh_coredump-2014-03-27-09\:54\:52
# crash /usr/lib/debug/lib/modules/`uname -r`/vmlinux /var/lib/libvirt/qemu/dump/virsh_coredump-2014-03-27-09\:54\:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment