@samitouri / QOSamiQemu / commits / 58b70f21ba

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>

Daniel P. Berrangé committed Jul 6, 2026 at 14:58 UTC 58b70f21ba6364be4f79d9f9c56b334341051bfd
7 files changed +27 -15
docs/about/deprecated.rst
+10
@@ -61,6 +61,16 @@ The ``debug-threads`` option of the ``-name`` argument is now
61 ignored. Thread naming is unconditionally enabled for all platforms
62 where it is supported.
63
64 +``-mon`` option (since 11.1)
65 +''''''''''''''''''''''''''''
66 +
67 +The ``-mon`` option was the generic mechanism for creating monitor
68 +objects if the convenience ``-qmp`` or ``-monitor`` options were not
69 +flexible enough. The monitor objects have been converted to QOM, so
70 +``-mon mode=readline`` is replaced by ``-object monitor-hmp`` and
71 +``-mon mode=control`` is replaced by ``-object monitor-qmp``. The
72 +short convenience options are not deprecated, only ``-mon``.
73 +
74 QEMU Machine Protocol (QMP) commands
75 ------------------------------------
76
docs/devel/writing-monitor-commands.rst
+2 -2
@@ -52,8 +52,8 @@ shown here.
52 First, QEMU should be started like this::
53
54 # qemu-system-TARGET [...] \
55 - -chardev socket,id=qmp,port=4444,host=localhost,server=on \
56 - -mon chardev=qmp,mode=control,pretty=on
55 + -chardev socket,id=chrqmp0,port=4444,host=localhost,server=on \
56 + -object monitor-qmp,chardev=chrqmp0,pretty=on,id=qmp0
57
58 Then, in a different terminal::
59
docs/system/arm/xenpvh.rst
+2 -2
@@ -27,9 +27,9 @@ Sample QEMU xenpvh commands for running and connecting with Xen:
27
28 qemu-system-aarch64 -xen-domid 1 \
29 -chardev socket,id=libxl-cmd,path=qmp-libxl-1,server=on,wait=off \
30 - -mon chardev=libxl-cmd,mode=control \
30 + -object monitor-qmp,id=qmp0,chardev=libxl-cmd \
31 -chardev socket,id=libxenstat-cmd,path=qmp-libxenstat-1,server=on,wait=off \
32 - -mon chardev=libxenstat-cmd,mode=control \
32 + -object monitor-qmp,id=qmp1,chardev=libxenstat-cmd \
33 -xen-attach -name guest0 -vnc none -display none -nographic \
34 -machine xenpvh -m 1301 \
35 -chardev socket,id=chrtpm,path=tmp/vtpm2/swtpm-sock \
docs/system/i386/xen.rst
+2 -1
@@ -79,7 +79,8 @@ of type ``xen-console`` to connect to it. For the Xen console equivalent of
79 the handy ``-serial mon:stdio`` option, for example:
80
81 .. parsed-literal::
82 - -chardev stdio,mux=on,id=char0,signal=off -mon char0 \\
82 + -chardev stdio,mux=on,id=char0,signal=off \\
83 + -object monitor-hmp,chardev=char0,id=hmp0 \\
84 -device xen-console,chardev=char0
85
86 The Xen network device is ``xen-net-device``, which becomes the default NIC
docs/system/i386/xenpvh.rst
+2 -2
@@ -33,9 +33,9 @@ case you need to construct one manually:
33
34 qemu-system-i386 -xen-domid 3 -no-shutdown \
35 -chardev socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-3,server=on,wait=off \
36 - -mon chardev=libxl-cmd,mode=control \
36 + -object monitor-qmp,id=qmp0,chardev=libxl-cmd \
37 -chardev socket,id=libxenstat-cmd,path=/var/run/xen/qmp-libxenstat-3,server=on,wait=off \
38 - -mon chardev=libxenstat-cmd,mode=control \
38 + -object monitor-qmp,id=qmp1,chardev=libxenstat-cmd \
39 -nodefaults \
40 -no-user-config \
41 -xen-attach -name g0 \
qemu-options.hx
+7 -8
@@ -4154,7 +4154,7 @@ The general form of a character device option is:
4154 ::
4155
4156 -chardev stdio,mux=on,id=char0 \
4157 - -mon chardev=char0,mode=readline \
4157 + -object monitor-hmp,id=hmp0,chardev=char0 \
4158 -serial chardev:char0 \
4159 -serial chardev:char0
4160
@@ -4166,7 +4166,7 @@ The general form of a character device option is:
4166 ::
4167
4168 -chardev stdio,mux=on,id=char0 \
4169 - -mon chardev=char0,mode=readline \
4169 + -object monitor-hmp,id=hmp0,chardev=char0 \
4170 -parallel chardev:char0 \
4171 -chardev tcp,...,mux=on,id=char1 \
4172 -serial chardev:char1 \
@@ -5004,12 +5004,12 @@ SRST
5004
5005 enables the QMP monitor on localhost port 4444 with pretty-printing.
5006
5007 - The use of ``-mon mode=readline`` is syntactic sugar
5007 + The use of ``-mon mode=readline`` is deprecated 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
5012 + The use of ``-mon mode=control`` is deprecated 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.
@@ -5771,8 +5771,7 @@ SRST
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.
5774 + Mixing ``-object`` with ``-monitor`` syntax is discouraged.
5775
5776 The ``readline`` parameter, which defaults to ``on``,
5777 controls whether the monitor provides line editing.
@@ -5785,8 +5784,8 @@ SRST
5784 to dynamically delete the monitor at runtime. Note
5785 that monitors created using the historical syntax
5786 will be allocated IDs following the pattern ``compat_monitorNNN``.
5788 - Mixing ``-object`` with ``-qmp``, ``-qmp-pretty`` and
5789 - ``-mon`` syntax is discouraged.
5787 + Mixing ``-object`` with ``-qmp`` and ``-qmp-pretty``
5788 + syntax is discouraged.
5789
5790 The ``pretty`` parameter, which defaults to ``off``,
5791 controls whether the monitor responses are pretty
system/vl.c
+2
@@ -3239,6 +3239,8 @@ void qemu_init(int argc, char **argv)
3239 default_monitor = 0;
3240 break;
3241 case QEMU_OPTION_mon:
3242 + warn_report_once("'-mon' is deprecated, use '-object' with "
3243 + "'monitor-hmp' or 'monitor-qmp' types instead");
3244 if (!qemu_opts_parse_noisily(qemu_find_opts("mon"), optarg,
3245 true)) {
3246 exit(1);