qmp-intro.txt 2.1 KB

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