2009-11-27 01:59:06 +01:00
|
|
|
QEMU Monitor Protocol
|
|
|
|
=====================
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
-------------
|
|
|
|
|
2009-12-18 16:25:02 +01:00
|
|
|
The QEMU Monitor Protocol (QMP) allows applications to communicate with
|
|
|
|
QEMU's Monitor.
|
2009-11-27 01:59:06 +01:00
|
|
|
|
2009-12-18 16:25:02 +01:00
|
|
|
QMP is JSON[1] based and has the following features:
|
|
|
|
|
|
|
|
- Lightweight, text-based, easy to parse data format
|
|
|
|
- Asynchronous events support
|
|
|
|
- Stability
|
2009-11-27 01:59:06 +01:00
|
|
|
|
|
|
|
For more information, please, refer to the following files:
|
|
|
|
|
2009-12-18 16:25:02 +01:00
|
|
|
o qmp-spec.txt QEMU Monitor Protocol current specification
|
2009-11-27 01:59:06 +01:00
|
|
|
o qmp-events.txt List of available asynchronous events
|
|
|
|
|
|
|
|
There are also two simple Python scripts available:
|
|
|
|
|
|
|
|
o qmp-shell A shell
|
2009-12-18 16:25:02 +01:00
|
|
|
o vm-info Show some information about the Virtual Machine
|
2009-11-27 01:59:06 +01:00
|
|
|
|
|
|
|
[1] http://www.json.org
|
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
2009-12-18 16:25:02 +01:00
|
|
|
To enable QMP, QEMU has to be started in "control mode". There are
|
|
|
|
two ways of doing this, the simplest one is using the the '-qmp'
|
|
|
|
command-line option.
|
2009-11-27 01:59:06 +01:00
|
|
|
|
|
|
|
For example:
|
|
|
|
|
2009-12-18 16:25:02 +01:00
|
|
|
$ qemu [...] -qmp tcp:localhost:4444,server
|
2009-11-27 01:59:06 +01:00
|
|
|
|
|
|
|
Will start QEMU in control mode, waiting for a client TCP connection
|
|
|
|
on localhost port 4444.
|
|
|
|
|
2009-12-18 16:25:02 +01:00
|
|
|
It is also possible to use the '-mon' command-line option to have
|
|
|
|
more complex combinations. Please, refer to the QEMU's manpage for
|
|
|
|
more information.
|
|
|
|
|
|
|
|
Simple Testing
|
|
|
|
--------------
|
|
|
|
|
|
|
|
To manually test QMP one can connect with telnet and issue commands:
|
2009-11-27 01:59:06 +01:00
|
|
|
|
|
|
|
$ telnet localhost 4444
|
2009-12-18 16:25:02 +01:00
|
|
|
Trying 127.0.0.1...
|
2009-11-27 01:59:06 +01:00
|
|
|
Connected to localhost.
|
|
|
|
Escape character is '^]'.
|
|
|
|
{"QMP": {"capabilities": []}}
|
|
|
|
{ "execute": "query-version" }
|
2009-12-18 16:25:02 +01:00
|
|
|
{"return": {"qemu": "0.11.50", "package": ""}}
|
2009-11-27 01:59:06 +01:00
|
|
|
|
|
|
|
Contact
|
|
|
|
-------
|
|
|
|
|
|
|
|
http://www.linux-kvm.org/page/MonitorProtocol
|
|
|
|
Luiz Fernando N. Capitulino <lcapitulino@redhat.com>
|