]> Git Repo - qemu.git/blame - docs/interop/qmp-intro.txt
Merge remote-tracking branch 'remotes/kraxel/tags/seabios-1.12-20181120-pull-request...
[qemu.git] / docs / interop / qmp-intro.txt
CommitLineData
52bbff77 1 QEMU Machine Protocol
26d5a1cd
LC
2 =====================
3
4Introduction
52bbff77 5------------
26d5a1cd 6
52bbff77
LC
7The QEMU Machine Protocol (QMP) allows applications to operate a
8QEMU instance.
26d5a1cd 9
52bbff77 10QMP 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 16For detailed information on QMP's usage, please, refer to the following files:
26d5a1cd 17
52bbff77 18o qmp-spec.txt QEMU Machine Protocol current specification
56e8bdd4 19o qemu-qmp-ref.html QEMU QMP commands and events (auto-generated at build-time)
26d5a1cd 20
70b7fba9 21[1] https://www.json.org
26d5a1cd
LC
22
23Usage
24-----
25
52bbff77
LC
26You can use the -qmp option to enable QMP. For example, the following
27makes QMP available on localhost port 4444:
d29f3196 28
52bbff77 29$ qemu [...] -qmp tcp:localhost:4444,server,nowait
26d5a1cd 30
52bbff77
LC
31However, for more flexibility and to make use of more options, the -mon
32command-line option should be used. For instance, the following example
33creates one HMP instance (human monitor) on stdio and one QMP instance
34on 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 40Please, refer to QEMU's manpage for more information.
052f1b9b
LC
41
42Simple Testing
43--------------
44
d29f3196 45To manually test QMP one can connect with telnet and issue commands by hand:
26d5a1cd
LC
46
47$ telnet localhost 4444
052f1b9b 48Trying 127.0.0.1...
26d5a1cd
LC
49Connected to localhost.
50Escape character is '^]'.
52bbff77
LC
51{
52 "QMP": {
53 "version": {
54 "qemu": {
71696cc6
MA
55 "micro": 0,
56 "minor": 0,
57 "major": 3
58 },
59 "package": "v3.0.0"
60 },
52bbff77 61 "capabilities": [
71696cc6 62 "oob"
52bbff77
LC
63 ]
64 }
65}
d29f3196 66
52bbff77
LC
67{ "execute": "qmp_capabilities" }
68{
69 "return": {
70 }
71}
72
73{ "execute": "query-status" }
74{
75 "return": {
76 "status": "prelaunch",
77 "singlestep": false,
78 "running": false
79 }
80}
81
bb46af41 82Please refer to docs/interop/qemu-qmp-ref.* for a complete command
eb815e24 83reference, generated from qapi/qapi-schema.json.
52bbff77
LC
84
85QMP wiki page
86-------------
26d5a1cd 87
70b7fba9 88https://wiki.qemu.org/QMP
This page took 0.405139 seconds and 4 git commands to generate.