]>
Commit | Line | Data |
---|---|---|
52bbff77 | 1 | QEMU Machine Protocol |
26d5a1cd LC |
2 | ===================== |
3 | ||
4 | Introduction | |
52bbff77 | 5 | ------------ |
26d5a1cd | 6 | |
52bbff77 LC |
7 | The QEMU Machine Protocol (QMP) allows applications to operate a |
8 | QEMU instance. | |
26d5a1cd | 9 | |
52bbff77 | 10 | QMP is JSON[1] based and features the following: |
052f1b9b LC |
11 | |
12 | - Lightweight, text-based, easy to parse data format | |
d29f3196 LC |
13 | - Asynchronous messages support (ie. events) |
14 | - Capabilities Negotiation | |
26d5a1cd | 15 | |
d29f3196 | 16 | For detailed information on QMP's usage, please, refer to the following files: |
26d5a1cd | 17 | |
52bbff77 | 18 | o qmp-spec.txt QEMU Machine Protocol current specification |
56e8bdd4 | 19 | o qemu-qmp-ref.html QEMU QMP commands and events (auto-generated at build-time) |
26d5a1cd | 20 | |
26d5a1cd LC |
21 | [1] http://www.json.org |
22 | ||
23 | Usage | |
24 | ----- | |
25 | ||
52bbff77 LC |
26 | You can use the -qmp option to enable QMP. For example, the following |
27 | makes QMP available on localhost port 4444: | |
d29f3196 | 28 | |
52bbff77 | 29 | $ qemu [...] -qmp tcp:localhost:4444,server,nowait |
26d5a1cd | 30 | |
52bbff77 LC |
31 | However, for more flexibility and to make use of more options, the -mon |
32 | command-line option should be used. For instance, the following example | |
33 | creates one HMP instance (human monitor) on stdio and one QMP instance | |
34 | on localhost port 4444: | |
26d5a1cd | 35 | |
52bbff77 LC |
36 | $ qemu [...] -chardev stdio,id=mon0 -mon chardev=mon0,mode=readline \ |
37 | -chardev socket,id=mon1,host=localhost,port=4444,server,nowait \ | |
38 | -mon chardev=mon1,mode=control,pretty=on | |
26d5a1cd | 39 | |
d29f3196 | 40 | Please, refer to QEMU's manpage for more information. |
052f1b9b LC |
41 | |
42 | Simple Testing | |
43 | -------------- | |
44 | ||
d29f3196 | 45 | To manually test QMP one can connect with telnet and issue commands by hand: |
26d5a1cd LC |
46 | |
47 | $ telnet localhost 4444 | |
052f1b9b | 48 | Trying 127.0.0.1... |
26d5a1cd LC |
49 | Connected to localhost. |
50 | Escape character is '^]'. | |
52bbff77 LC |
51 | { |
52 | "QMP": { | |
53 | "version": { | |
54 | "qemu": { | |
55 | "micro": 50, | |
56 | "minor": 6, | |
57 | "major": 1 | |
58 | }, | |
59 | "package": "" | |
60 | }, | |
61 | "capabilities": [ | |
62 | ] | |
63 | } | |
64 | } | |
d29f3196 | 65 | |
52bbff77 LC |
66 | { "execute": "qmp_capabilities" } |
67 | { | |
68 | "return": { | |
69 | } | |
70 | } | |
71 | ||
72 | { "execute": "query-status" } | |
73 | { | |
74 | "return": { | |
75 | "status": "prelaunch", | |
76 | "singlestep": false, | |
77 | "running": false | |
78 | } | |
79 | } | |
80 | ||
81 | Please, refer to the qapi-schema.json file for a complete command reference. | |
82 | ||
83 | QMP wiki page | |
84 | ------------- | |
26d5a1cd | 85 | |
85938981 | 86 | http://wiki.qemu-project.org/QMP |