关闭

How to debug QEMU (by quqi99)

标签: qemudebug
1069人阅读 评论(1) 收藏 举报
分类:

**作者:张华 发表于: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=1
LIBVIRT_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 --loop
error: internal error: virsh qemu-monitor-event: no domain VSH_OT_DATA option
event 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 test

hua@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) quit

hua@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 blockstats
virtio0: 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::12345
Waiting for gdb connection on device 'tcp::12345'

hua@node1:/bak/linux$ gdb ./qemu -q
./qemu: Success.
(gdb) target remote localhost:12345 
0
0

猜你在找
深度学习基础与TensorFlow实践
【在线峰会】前端开发重点难点技术剖析与创新实践
【在线峰会】一天掌握物联网全栈开发之道
【在线峰会】如何高质高效的进行Android技术开发
机器学习40天精英计划
Python数据挖掘与分析速成班
微信小程序开发实战
JFinal极速开发企业实战
备战2017软考 系统集成项目管理工程师 学习套餐
Python大型网络爬虫项目开发实战(全套)
查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1352796次
    • 积分:15415
    • 等级:
    • 排名:第661名
    • 原创:290篇
    • 转载:10篇
    • 译文:0篇
    • 评论:298条