[PATCH] system: improve -mon deprecation warning

Daniel P. Berrangé posted 1 patch 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260824122942.85863-1-berrange@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
system/vl.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
[PATCH] system: improve -mon deprecation warning
Posted by Daniel P. Berrangé 1 month ago
Expand the text a bit to make the new syntax more explicit and point
users to the man page for further info.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 system/vl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/system/vl.c b/system/vl.c
index 061cbdf860..d5b5392569 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -3239,8 +3239,11 @@ 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");
+                warn_report_once("'-mon' is deprecated. Switch to either "
+                                 "'-object monitor-hmp,id=ID,chardev=CHR-ID' "
+                                 "or '-object monitor-qmp,id=qmpNN,chardev=CHR-ID' "
+                                 "instead. See '-object' docs in 'qemu(1)' for further "
+                                 "configuration guidance.");
                 if (!qemu_opts_parse_noisily(qemu_find_opts("mon"), optarg,
                                              true)) {
                     exit(1);
-- 
2.55.0


Re: [PATCH] system: improve -mon deprecation warning
Posted by Philippe Mathieu-Daudé 1 month ago
On 24/8/26 14:29, Daniel P. Berrangé wrote:
> Expand the text a bit to make the new syntax more explicit and point
> users to the man page for further info.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   system/vl.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/system/vl.c b/system/vl.c
> index 061cbdf860..d5b5392569 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -3239,8 +3239,11 @@ 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");
> +                warn_report_once("'-mon' is deprecated. Switch to either "
> +                                 "'-object monitor-hmp,id=ID,chardev=CHR-ID' "
> +                                 "or '-object monitor-qmp,id=qmpNN,chardev=CHR-ID' "
> +                                 "instead. See '-object' docs in 'qemu(1)' for further "
> +                                 "configuration guidance.");

Looking at commit 58b70f21ba6 ("docs: mark '-mon' as deprecated in
favour of -object") I'm not sure this is a good idea to document
'-object monitor-qmp' at all on CLI help. CLI users looking at
help output are likely users of '-mon' for HMP. My 2 cents.
>                   if (!qemu_opts_parse_noisily(qemu_find_opts("mon"), optarg,
>                                                true)) {
>                       exit(1);


Re: [PATCH] system: improve -mon deprecation warning
Posted by Daniel P. Berrangé 1 month ago
On Thu, Aug 27, 2026 at 10:56:44AM +0200, Philippe Mathieu-Daudé wrote:
> On 24/8/26 14:29, Daniel P. Berrangé wrote:
> > Expand the text a bit to make the new syntax more explicit and point
> > users to the man page for further info.
> > 
> > Reported-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >   system/vl.c | 7 +++++--
> >   1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/system/vl.c b/system/vl.c
> > index 061cbdf860..d5b5392569 100644
> > --- a/system/vl.c
> > +++ b/system/vl.c
> > @@ -3239,8 +3239,11 @@ 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");
> > +                warn_report_once("'-mon' is deprecated. Switch to either "
> > +                                 "'-object monitor-hmp,id=ID,chardev=CHR-ID' "
> > +                                 "or '-object monitor-qmp,id=qmpNN,chardev=CHR-ID' "
> > +                                 "instead. See '-object' docs in 'qemu(1)' for further "
> > +                                 "configuration guidance.");
> 
> Looking at commit 58b70f21ba6 ("docs: mark '-mon' as deprecated in
> favour of -object") I'm not sure this is a good idea to document
> '-object monitor-qmp' at all on CLI help. CLI users looking at
> help output are likely users of '-mon' for HMP. My 2 cents.

The warnings here get reported in machine use of QEMU too, not just
interactive usage. In libvirt they'll end up in
/var/log/libvirt/qemu/$GUEST.log.

I expect most end user non-managed launches of QEMU are using the
higher level -monitor for HMP, with -mon more likely machine usage.

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|


Re: [PATCH] system: improve -mon deprecation warning
Posted by Peter Maydell 1 month ago
On Mon, 24 Aug 2026 at 13:29, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> Expand the text a bit to make the new syntax more explicit and point
> users to the man page for further info.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  system/vl.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/system/vl.c b/system/vl.c
> index 061cbdf860..d5b5392569 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -3239,8 +3239,11 @@ 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");
> +                warn_report_once("'-mon' is deprecated. Switch to either "
> +                                 "'-object monitor-hmp,id=ID,chardev=CHR-ID' "
> +                                 "or '-object monitor-qmp,id=qmpNN,chardev=CHR-ID' "

why the difference in id=ID vs id=qmpNN ?

> +                                 "instead. See '-object' docs in 'qemu(1)' for further "
> +                                 "configuration guidance.");

Personally I think of the HTML docs as our primary documentation
and the manpages as a kind of "not very well maintained extracted
subset", so I wouldn't want to point people at qemu(1).

thanks
-- PMM
Re: [PATCH] system: improve -mon deprecation warning
Posted by Daniel P. Berrangé 1 month ago
On Thu, Aug 27, 2026 at 09:48:50AM +0100, Peter Maydell wrote:
> On Mon, 24 Aug 2026 at 13:29, Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > Expand the text a bit to make the new syntax more explicit and point
> > users to the man page for further info.
> >
> > Reported-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >  system/vl.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/system/vl.c b/system/vl.c
> > index 061cbdf860..d5b5392569 100644
> > --- a/system/vl.c
> > +++ b/system/vl.c
> > @@ -3239,8 +3239,11 @@ 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");
> > +                warn_report_once("'-mon' is deprecated. Switch to either "
> > +                                 "'-object monitor-hmp,id=ID,chardev=CHR-ID' "
> > +                                 "or '-object monitor-qmp,id=qmpNN,chardev=CHR-ID' "
> 
> why the difference in id=ID vs id=qmpNN ?

A mistake :-)

> > +                                 "instead. See '-object' docs in 'qemu(1)' for further "
> > +                                 "configuration guidance.");
> 
> Personally I think of the HTML docs as our primary documentation
> and the manpages as a kind of "not very well maintained extracted
> subset", so I wouldn't want to point people at qemu(1).

The manpages have full coverage of the CLI args with identical
content as the online manual.

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|