Skip to contentSkip to conversation

QEMU Monitor Protocol

RFC New Luiz Capitulino 1 participant 1 message Jun 23, 2009

lore
Share & tools
lore
#0 lore raw

cover QEMU Monitor Protocol

Hi there,

It is already known that QEMU does not provide a way for applications to control it at the "machine level", that is, the current Monitor interface was designed with human interaction in mind.

This problem has already been discussed at least twice, the last thead on the topic can be found here:

http://lists.gnu.org/archive/html/qemu-devel/2009-01/msg00655.html

Basically, some people have suggested to export Monitor's functionality through a C library, while others have suggested a simple text protocol.

This patch series implements a prototype of the text protocol approach, which I called QEMU Monitor Protocol, or QMP.

I have chosen the text protocol because:

1. It is easier to implement
2. If needed, a C library can be built on top of it

QMP has the following features:

o Easy to be parsed by programs
o Extensible
o Asynchronous messages support

With this series I hope to get as much feedback as possible on the protocol specification and the implementation, and also have a merge plan.

To enable QMP one has to start QEMU with:

$ qemu [...] -monitor control,<device>

For example:

$ qemu [...] -monitor control,tcp:localhost:4444,server

Then the application can open a TCP connection to localhost:4444 and speak to QEMU using QMP.

A full protocol specification can be found (and discussed) in the first patch of this series.

Some additional comments:

o Don't take the implementation too serious, it is just a hac^W prototype

o Available commands: quit, cont, stop, system_reset, system_powerdown, balloon, info balloon, info blockstats

o Available events: reboot, shutdown, powerdown

Luiz Capitulino (11):
QMP: Introduce specification file
QMP: Introduce MONITOR_USE_CONTROL flag
QMP: Introduce protocol print functions
QMP: Make monitor_handle_command() QMP aware
QMP: Introduce control mode chardev handling
QMP: Introduce asynchronous events infrastructure
QMP: Enable simple commands
QMP: Port balloon command
QMP: Port 'info blockstats' command
QMP: Introduce basic events
QMP: Command-line flag to enable control mode

 block.c                   |   18 ++--
 monitor-protocol-spec.txt |  180 ++++++++++++++++++++++++++++++++++++++
 monitor.c                 |  211 +++++++++++++++++++++++++++++++++++++++++++-
 monitor.h                 |   14 +++
 qemu-tool.c               |   16 ++++
 vl.c                      |    8 ++-
 6 files changed, 431 insertions(+), 16 deletions(-)
 create mode 100644 monitor-protocol-spec.txt