How to debug QEMU (by quqi99)

来源:互联网 发布:淘宝客怎么拉人进qq群 编辑:程序博客网 时间:2024/05/18 03:00

**作者:张华 发表于:2016-08-11
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明
( http://blog.csdn.net/quqi99 )**

LOG

1, Capture DEBUG for QEMU & libvirt but only WARN + ERROR for the rest, modify the file /etc/libvirt/libvirtd.conf

log_filters="1:qemu 1:libvirt 3:security 3:event 3:util 3:file"log_outputs="1:file:/var/log/libvirt/libvirtd.log"

2, To log all libvirt API calls, export (/etc/default/libvirt-bin):

LIBVIRT_DEBUG=1LIBVIRT_LOG_FILTERS="1:qemu"LIBVIRT_LOG_OUTPUTS="1:journald 1:file:virsh.log"

3, sudo service libvirt-bin restart
/var/log/libvirt/qemu/instance-00000002.log
/var/log/libvirt/libvirtd.log

Observe any arbitrary QMP events

#sudo virsh qemu-monitor-command instance-00000002 --pretty '{"execute":"query-commands"}'#sudo virsh qemu-monitor-command instance-00000002 --pretty '{"execute":"query-block"}'sudo virsh qemu-monitor-event instance-00000002 --pretty --loop#nova live-migrate --block-migrate vm1 $DEST-HOST#sudo virsh migrate –verbose --copy-storage-inc --p2p --live vm1 qemu+ssh://root@dest/system$ sudo virsh qemu-monitor-event instance-00000002 --pretty --looperror: internal error: virsh qemu-monitor-event: no domain VSH_OT_DATA optionevent POWERDOWN at 1470898098.552573 for domain instance-00000002: <null>event NIC_RX_FILTER_CHANGED at 1470898099.457593 for domain instance-00000002: {    "name": "net0",    "path": "/machine/peripheral/net0/virtio-backend"}event SHUTDOWN at 1470898100.598173 for domain instance-00000002: <null>event STOP at 1470898100.600347 for domain instance-00000002: <null>event SHUTDOWN at 1470898100.601556 for domain instance-00000002: <null>event RESUME at 1470898102.503793 for domain instance-00000002: <null>event NIC_RX_FILTER_CHANGED at 1470898122.381443 for domain instance-00000002: {    "name": "net0",    "path": "/machine/peripheral/net0/virtio-backend"}**

Monitor

#virtio-balloon stats virtqueue testhua@node1:/images/kvm$ sudo qemu-system-x86_64 -enable-kvm -m 1024 -cpu host -drive if=virtio,cache=none,format=qcow2,file=./ubuntu14.04_test.qcow2 -device virtio-balloon-pci,id=virtio-balloon0 -S -monitor stdio QEMU 2.5.0 monitor - type 'help' for more information(qemu) qom-set virtio-balloon0 guest-stats-polling-interval 5(qemu) c(qemu) savevm(qemu) quithua@node1:/images/kvm$ sudo qemu-system-x86_64 -enable-kvm -m 1024 -cpu host -drive if=virtio,cache=none,format=qcow2,file=./ubuntu14.04_test.qcow2 -device virtio-balloon-pci,id=virtio-balloon0 -S -monitor stdio QEMU 2.5.0 monitor - type 'help' for more information(qemu) loadvm 1(qemu) c# Migration(qemu) migrate tcp:127.0.0.1:1234   #with: -incoming tcp::1234(qemu) info blockstatsvirtio0: rd_bytes=0 wr_bytes=20480 rd_operations=0 wr_operations=5 flush_operations=2 wr_total_time_ns=859822442 rd_total_time_ns=0 flush_total_time_ns=52308038 rd_merged=0 wr_merged=0 idle_time_ns=287986673745(qemu) gdbserver tcp::12345Waiting for gdb connection on device 'tcp::12345'hua@node1:/bak/linux$ gdb ./qemu -q./qemu: Success.(gdb) target remote localhost:12345 
0 0
原创粉丝点击