@samitouri / QOSamiQemu / commits / 864b145c58

qemu-options: document new monitor-hmp and monitor-qmp objects

Add new docs for the `-object monitor-hmp` and `-object monitor-qmp` options, updating `-mon` to state that it is legacy syntax sugar for the new `-object` args. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20260706135824.2623960-35-berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Daniel P. Berrangé committed Jul 6, 2026 at 14:58 UTC 864b145c5839cce45f74217c70a8df5da5f5d14d
1 file changed +58 -3
qemu-options.hx
+58 -3
@@ -4955,6 +4955,11 @@ SRST
4955 port). The default device is ``vc`` in graphical mode and ``stdio``
4956 in non graphical mode. Use ``-monitor none`` to disable the default
4957 monitor.
4958 +
4959 + The use of ``-monitor dev`` is syntactic sugar for creating a character
4960 + device from ``dev`` and pairing it with ``-object monitor-hmp``.
4961 + Both the character device and monitor object will be given an ID
4962 + ``compat_monitorNNN`` where ``NNN`` is a counter starting from 0.
4963 ERST
4964 DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \
4965 "-qmp dev like -monitor but opens in 'control' mode\n",
@@ -4966,9 +4971,10 @@ SRST
4971
4972 -qmp tcp:localhost:4444,server=on,wait=off
4973
4969 - Not all options are configurable via this syntax; for maximum
4970 - flexibility use the ``-mon`` option and an accompanying ``-chardev``.
4971 -
4974 + The use of ``-qmp dev`` is syntactic sugar for creating a character
4975 + device from ``dev`` and pairing it with ``-object monitor-qmp``.
4976 + Both the character device and monitor object will be given an ID
4977 + ``compat_monitorNNN`` where ``NNN`` is a counter starting from 0.
4978 ERST
4979 DEF("qmp-pretty", HAS_ARG, QEMU_OPTION_qmp_pretty, \
4980 "-qmp-pretty dev like -qmp but uses pretty JSON formatting\n",
@@ -4997,6 +5003,16 @@ SRST
5003 -mon chardev=mon1,mode=control,pretty=on
5004
5005 enables the QMP monitor on localhost port 4444 with pretty-printing.
5006 +
5007 + The use of ``-mon mode=readline`` is syntactic sugar
5008 + for the new ``-object monitor-hmp`` option, each use of which
5009 + creates an object with the ID ``compat_monitorNNN`` where ``NNN`` is
5010 + a counter starting from 0.
5011 +
5012 + The use of ``-mon mode=control`` is syntactic sugar
5013 + for the new ``-object monitor-qmp`` option, each use of which
5014 + creates an object with the ID ``compat_monitorNNN`` where ``NNN`` is
5015 + a counter starting from 0.
5016 ERST
5017
5018 DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \
@@ -5747,6 +5763,45 @@ SRST
5763 they are specified. Note that the 'id' property must be set. These
5764 objects are placed in the '/objects' path.
5765
5766 + ``-object monitor-hmp,id=id,chardev=chardev_id,readline=on|off``
5767 + Set up a monitor running the Human Monitor Protocol,
5768 + connected to the chardev ``chardev_id``.
5769 +
5770 + The ``id`` parameter is a unique ID that can be used
5771 + to dynamically delete the monitor at runtime. Note
5772 + that monitors created using the historical syntax
5773 + will be allocated IDs following the pattern ``compat_monmitorNNN``.
5774 + Mixing ``-object`` with ``-monitor`` and ``-mon`` syntax is
5775 + discouraged.
5776 +
5777 + The ``readline`` parameter, which defaults to ``on``,
5778 + controls whether the monitor provides line editing.
5779 +
5780 + ``-object monitor-qmp,id=id,chardev=chardev_id,pretty=on|off,close-action=none|delete``
5781 + Set up a monitor running the QEMU Monitor Protocol,
5782 + connected to the chardev ``chardev_id``.
5783 +
5784 + The ``id`` parameter is a unique ID that can be used
5785 + to dynamically delete the monitor at runtime. Note
5786 + that monitors created using the historical syntax
5787 + will be allocated IDs following the pattern ``compat_monitorNNN``.
5788 + Mixing ``-object`` with ``-qmp``, ``-qmp-pretty`` and
5789 + ``-mon`` syntax is discouraged.
5790 +
5791 + The ``pretty`` parameter, which defaults to ``off``,
5792 + controls whether the monitor responses are pretty
5793 + printed as multi-line indented JSON, as opposed to
5794 + constrained to a single line without extraneous
5795 + whitespace.
5796 +
5797 + The ``close-action`` parameter, which defaults to ``none``,
5798 + controls what happens when the connection to the monitor
5799 + is terminated by the user. If set to ``delete``, then the
5800 + ``monitor-qmp`` object and its associated character
5801 + device are both immediately deleted. This can be useful
5802 + if an extra monitor was hotplugged for a specific task
5803 + and should be unplugged when completed.
5804 +
5805 ``-object memory-backend-file,id=id,size=size,mem-path=dir,share=on|off,discard-data=on|off,merge=on|off,dump=on|off,prealloc=on|off,host-nodes=host-nodes,policy=default|preferred|bind|interleave,align=align,offset=offset,readonly=on|off,rom=on|off|auto``
5806 Creates a memory file backend object, which can be used to back
5807 the guest RAM with huge pages.