On Fri, Jun 26, 2026 at 01:19:30AM +0400, Marc-André Lureau wrote:
> When QEMU is built without HMP support, reject '-monitor' (which
> requests readline/HMP mode) early in monitor_init_opts() with a
> clear error message directing users to '-qmp' instead.
>
> Signed-off-by: Marc-Andre Lureau <[email protected]>
> ---
> monitor/monitor.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
This will need rewriting from scratch as the code all changed
with the introduction of QOM classes for monitors
>
> diff --git a/monitor/monitor.c b/monitor/monitor.c
> index 2dec0e299af..f443f406b4c 100644
> --- a/monitor/monitor.c
> +++ b/monitor/monitor.c
> @@ -764,6 +764,16 @@ int monitor_init_opts(QemuOpts *opts, Error **errp)
> MonitorOptions *options;
> int ret;
>
> +#ifndef CONFIG_HMP
> + const char *mode = qemu_opt_get(opts, "mode");
> + /* readline is HMP.. */
> + if (mode && g_str_equal(mode, "readline")) {
> + error_setg(errp, "HMP monitor is not available,"
> + " use '-qmp' instead of '-monitor'");
> + return -1;
> + }
> +#endif
> +
> v = opts_visitor_new(opts);
> visit_type_MonitorOptions(v, NULL, &options, errp);
> visit_free(v);
>
> --
> 2.54.0
>
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 :|