MonitorProtocol: Difference between revisions

From KVM
No edit summary
No edit summary
Line 15: Line 15:
== Solution ==
== Solution ==


Improve QEMU's Monitor to support a JSON based stable protocol.
Improve QEMU's Monitor to support a machine protocol with the following features:
 
* Use a lightweight, text-based, easy to parse data format (JSON has been chosen)
* Protocol stability should be guaranteed
* Asynchronous events support
* Parallel execution of commands
* A standard way to query protocol capabilities
 
A draft specification already exists and can be found [http://repo.or.cz/w/qemu/qmp-unstable.git?a=blob;f=QMP/qmp-spec.txt;h=3633b0dddd8205328d33d51f0d35ce1c76c0d593;hb=HEAD here].


== Project status (2009-10-20) ==
== Project status (2009-10-20) ==
Line 53: Line 61:
'''NOTE''': all branches in this repository are constantly rebased.
'''NOTE''': all branches in this repository are constantly rebased.


The ''master'' branch contains a functional QMP implementation for emission only (includes asynchronous messages). The current specification draft and other documentation can be found in the [http://repo.or.cz/w/qemu/qmp-unstable.git?a=tree;f=QMP;h=290262119cc6c9e07a6ef7a078384ef12c491e51;hb=HEAD QMP directory ] of the same branch.
The ''master'' branch contains a functional QMP implementation for emission only (includes asynchronous messages). Protocol documentation can be found in the [http://repo.or.cz/w/qemu/qmp-unstable.git?a=tree;f=QMP;h=290262119cc6c9e07a6ef7a078384ef12c491e51;hb=HEAD QMP directory ] of the same branch.


== History ==
== History ==

Revision as of 11:25, 26 October 2009

Monitor Protocol

The QEMU Monitor Protocol (QMP) project goal is to implement a JSON based protocol for QEMU.

Problem

QEMU does not provide a way for applications to control it at the "machine level", that is, the current existing interface (called Monitor) was designed for human interaction only.

This is very problematic for applications, for the following reasons:

  • It is needed to parse output meant to be read by humans
  • It is not reliable, because it is not always possible to know whether a command has been successfully executed or not
  • It lacks support for asynchronous events

Solution

Improve QEMU's Monitor to support a machine protocol with the following features:

  • Use a lightweight, text-based, easy to parse data format (JSON has been chosen)
  • Protocol stability should be guaranteed
  • Asynchronous events support
  • Parallel execution of commands
  • A standard way to query protocol capabilities

A draft specification already exists and can be found here.

Project status (2009-10-20)

Most of the infrastructure has been merged, a JSON decoder should be merged in the next days. The important missing parts are the error framework and the JSON encoder.

Additionally, all command handlers need to be converted to use QObjects. This work is in progress, but several handlers depend on the JSON decoder.

Main building blocks

  • QObject Layer (merged)
  • QObject Monitor infrastructure (merged)
  • JSON decoder (under review)
  • JSON encoder (not started)
  • Error framework (under discussion)

Command handlers conversion work

  • Input through QDict (merged)
  • Output in QObject style (in progress)
  • Error handling (not started)

Libqmp

Although this is still under discussion, we are also going to provide a C library with a stable ABI.

The short-term plan is to have a simple API to send commands and receive responses, this way C clients do not need to have their own JSON implementation.

The long-term plan is to provide a full management API for QEMU.

Development

The development takes place in the QMP unstable tree:

http://repo.or.cz/w/qemu/qmp-unstable.git

NOTE: all branches in this repository are constantly rebased.

The master branch contains a functional QMP implementation for emission only (includes asynchronous messages). Protocol documentation can be found in the QMP directory of the same branch.

History

This is the fourth proposal for a machine protocol, past discussions can be found in the following links: