QEMU Machine Protocol
The QEMU Machine Protocol (QMP) is a JSON-based protocol which allows applications to control a QEMU instance.
Features:
Lightweight, text-based, easy to parse data format
Asynchronous messages support (events)
Capabilities negotiation
API/ABI stability guarantees
Please, also check the README file for more information.
MULTIPLE WAYS TO ACCESS QEMU MACHINE PROTOCOL (QMP)
QMP via unix socket
First, invoke the qemu binary in control mode using qmp, and create a unix socket as below:
$ ./x86_64-softmmu/qemu-system-x86_64 --enable-kvm -smp 2 -m 1024 /export/p_w_picpaths/el6box1.qcow2 -qmp unix:./qmp-sock,server --monitor stdioQEMU waiting for connection on: unix:./qmp-sock,server
A few different ways to connect to the above qemu instance running in control mode, vi QMP:
Firstly, via
nc
:$ nc -U ./qmp-sock{"QMP": {"version": {"qemu": {"micro": 50, "minor": 4, "major": 1}, "package": ""}, "capabilities": []}}
But, with the above, you have to manually enable the QMP capabilities, and type each command in JSON syntax. It’s a bit cumbersome, & no history of commands typed is saved.
我的master thesis 用这个方法 实现VM的migration
———————————————————————————————————————–
QMP Supported Commands
http://qemu.weilnetz.de/w64/2012-12-04/qmp-commands.txt
QEMU Guest Agent
It is a daemon program running inside the domain which is supposed to help management applications with executing functions which need assistance of the guest OS. For example, freezing and thawing filesystems, entering suspend. However, guest agent (GA) is not bullet proof, and hostile guest OS can send spurious replies.
转载于:https://blog.51cto.com/christhai/1753655