docs: mark '-mon' as deprecated in favour of -object

The high level `-qmp` and `-monitor` options can remain as convenience
wrappers, but the low level `-mon` is completed obsoleted by the new
`-object` support with 'monitor-qmp' and 'monitor-hmp' types.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260706135824.2623960-36-berrange@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Editing accident fixed in qemu-options.hx]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2026-07-06 14:58:23 +01:00
committed by Markus Armbruster
parent 864b145c58
commit 58b70f21ba
7 changed files with 27 additions and 15 deletions

View File

@@ -61,6 +61,16 @@ The ``debug-threads`` option of the ``-name`` argument is now
ignored. Thread naming is unconditionally enabled for all platforms
where it is supported.
``-mon`` option (since 11.1)
''''''''''''''''''''''''''''
The ``-mon`` option was the generic mechanism for creating monitor
objects if the convenience ``-qmp`` or ``-monitor`` options were not
flexible enough. The monitor objects have been converted to QOM, so
``-mon mode=readline`` is replaced by ``-object monitor-hmp`` and
``-mon mode=control`` is replaced by ``-object monitor-qmp``. The
short convenience options are not deprecated, only ``-mon``.
QEMU Machine Protocol (QMP) commands
------------------------------------

View File

@@ -52,8 +52,8 @@ shown here.
First, QEMU should be started like this::
# qemu-system-TARGET [...] \
-chardev socket,id=qmp,port=4444,host=localhost,server=on \
-mon chardev=qmp,mode=control,pretty=on
-chardev socket,id=chrqmp0,port=4444,host=localhost,server=on \
-object monitor-qmp,chardev=chrqmp0,pretty=on,id=qmp0
Then, in a different terminal::

View File

@@ -27,9 +27,9 @@ Sample QEMU xenpvh commands for running and connecting with Xen:
qemu-system-aarch64 -xen-domid 1 \
-chardev socket,id=libxl-cmd,path=qmp-libxl-1,server=on,wait=off \
-mon chardev=libxl-cmd,mode=control \
-object monitor-qmp,id=qmp0,chardev=libxl-cmd \
-chardev socket,id=libxenstat-cmd,path=qmp-libxenstat-1,server=on,wait=off \
-mon chardev=libxenstat-cmd,mode=control \
-object monitor-qmp,id=qmp1,chardev=libxenstat-cmd \
-xen-attach -name guest0 -vnc none -display none -nographic \
-machine xenpvh -m 1301 \
-chardev socket,id=chrtpm,path=tmp/vtpm2/swtpm-sock \

View File

@@ -79,7 +79,8 @@ of type ``xen-console`` to connect to it. For the Xen console equivalent of
the handy ``-serial mon:stdio`` option, for example:
.. parsed-literal::
-chardev stdio,mux=on,id=char0,signal=off -mon char0 \\
-chardev stdio,mux=on,id=char0,signal=off \\
-object monitor-hmp,chardev=char0,id=hmp0 \\
-device xen-console,chardev=char0
The Xen network device is ``xen-net-device``, which becomes the default NIC

View File

@@ -33,9 +33,9 @@ case you need to construct one manually:
qemu-system-i386 -xen-domid 3 -no-shutdown \
-chardev socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-3,server=on,wait=off \
-mon chardev=libxl-cmd,mode=control \
-object monitor-qmp,id=qmp0,chardev=libxl-cmd \
-chardev socket,id=libxenstat-cmd,path=/var/run/xen/qmp-libxenstat-3,server=on,wait=off \
-mon chardev=libxenstat-cmd,mode=control \
-object monitor-qmp,id=qmp1,chardev=libxenstat-cmd \
-nodefaults \
-no-user-config \
-xen-attach -name g0 \

View File

@@ -4154,7 +4154,7 @@ The general form of a character device option is:
::
-chardev stdio,mux=on,id=char0 \
-mon chardev=char0,mode=readline \
-object monitor-hmp,id=hmp0,chardev=char0 \
-serial chardev:char0 \
-serial chardev:char0
@@ -4166,7 +4166,7 @@ The general form of a character device option is:
::
-chardev stdio,mux=on,id=char0 \
-mon chardev=char0,mode=readline \
-object monitor-hmp,id=hmp0,chardev=char0 \
-parallel chardev:char0 \
-chardev tcp,...,mux=on,id=char1 \
-serial chardev:char1 \
@@ -5004,12 +5004,12 @@ SRST
enables the QMP monitor on localhost port 4444 with pretty-printing.
The use of ``-mon mode=readline`` is syntactic sugar
The use of ``-mon mode=readline`` is deprecated syntactic sugar
for the new ``-object monitor-hmp`` option, each use of which
creates an object with the ID ``compat_monitorNNN`` where ``NNN`` is
a counter starting from 0.
The use of ``-mon mode=control`` is syntactic sugar
The use of ``-mon mode=control`` is deprecated syntactic sugar
for the new ``-object monitor-qmp`` option, each use of which
creates an object with the ID ``compat_monitorNNN`` where ``NNN`` is
a counter starting from 0.
@@ -5771,8 +5771,7 @@ SRST
to dynamically delete the monitor at runtime. Note
that monitors created using the historical syntax
will be allocated IDs following the pattern ``compat_monmitorNNN``.
Mixing ``-object`` with ``-monitor`` and ``-mon`` syntax is
discouraged.
Mixing ``-object`` with ``-monitor`` syntax is discouraged.
The ``readline`` parameter, which defaults to ``on``,
controls whether the monitor provides line editing.
@@ -5785,8 +5784,8 @@ SRST
to dynamically delete the monitor at runtime. Note
that monitors created using the historical syntax
will be allocated IDs following the pattern ``compat_monitorNNN``.
Mixing ``-object`` with ``-qmp``, ``-qmp-pretty`` and
``-mon`` syntax is discouraged.
Mixing ``-object`` with ``-qmp`` and ``-qmp-pretty``
syntax is discouraged.
The ``pretty`` parameter, which defaults to ``off``,
controls whether the monitor responses are pretty

View File

@@ -3239,6 +3239,8 @@ void qemu_init(int argc, char **argv)
default_monitor = 0;
break;
case QEMU_OPTION_mon:
warn_report_once("'-mon' is deprecated, use '-object' with "
"'monitor-hmp' or 'monitor-qmp' types instead");
if (!qemu_opts_parse_noisily(qemu_find_opts("mon"), optarg,
true)) {
exit(1);