[{"id":3674495,"web_url":"http://patchwork.ozlabs.org/comment/3674495/","msgid":"<20260407-erhitzen-anlaufen-ffbbd453251b@brauner>","list_archive_url":null,"date":"2026-04-07T20:59:05","subject":"Re: [PATCH v3 3/5] qapi: add monitor-add, monitor-remove,\n query-monitors commands","submitter":{"id":82326,"url":"http://patchwork.ozlabs.org/api/people/82326/","name":"Christian Brauner","email":"brauner@kernel.org"},"content":"On Tue, Apr 07, 2026 at 11:45:53AM +0100, Daniel P. Berrangé wrote:\n> On Tue, Apr 07, 2026 at 09:32:47AM +0200, Christian Brauner wrote:\n> > Add QMP commands for dynamic monitor lifecycle management:\n> > \n> > - monitor-add: Create a QMP monitor on an existing chardev at runtime.\n> >   The chardev must exist and not already have a frontend attached\n> >   (enforced by qemu_chr_fe_init()).  The new monitor starts in\n> >   capability negotiation mode.\n> > \n> > - monitor-remove: Remove a dynamically-added monitor.  CLI-created\n> >   monitors cannot be removed.  The removal sequence is:\n> \n> Why should we block removal of statically created monitors ? Our\n> normal approach is that the creation of objects via the command\n> line & QMP be indistinguishable.\n\nSounds fine to me.\n\n> \n> \n> > diff --git a/qapi/control.json b/qapi/control.json\n> > index 9a5302193d..fd58b57c31 100644\n> > --- a/qapi/control.json\n> > +++ b/qapi/control.json\n> > @@ -211,3 +211,107 @@\n> >        '*pretty': 'bool',\n> >        'chardev': 'str'\n> >    } }\n> > +\n> > +##\n> > +# @monitor-add:\n> > +#\n> > +# Add a QMP monitor on an existing character device backend.\n> > +#\n> > +# The chardev must already exist (created via chardev-add or CLI).\n> > +# The monitor begins in capability negotiation mode -- the first\n> > +# client to connect receives the QMP greeting.\n> > +#\n> > +# @id: Monitor identifier, must be unique among monitors\n> > +#\n> > +# @chardev: Name of the character device backend to attach to\n> > +#\n> > +# @pretty: Enable pretty-printing of QMP responses (default: false)\n> > +#\n> > +# Errors:\n> > +#     - GenericError if @id is already in use\n> > +#     - GenericError if @chardev does not exist\n> > +#\n> > +# Since: 11.0\n> \n> We're just about to release 11.0, so 11.1 is the earliest\n> opportunity to merge anything now.\n\nI mostly copy-pasted this together. I honestly had no idea what the\ncurrent release cycle is.\n\n> \n> > +#\n> > +# .. qmp-example::\n> > +#\n> > +#     -> { \"execute\": \"monitor-add\",\n> > +#          \"arguments\": { \"id\": \"extra-qmp\",\n> > +#                         \"chardev\": \"qmp-extra\" } }\n> > +#     <- { \"return\": {} }\n> > +##\n> > +{ 'command': 'monitor-add',\n> > +  'data': { 'id': 'str',\n> > +            'chardev': 'str',\n> > +            '*pretty': 'bool' } }\n> > +\n> > +##\n> > +# @monitor-remove:\n> > +#\n> > +# Remove a dynamically added QMP monitor.\n> > +#\n> > +# The monitor must have been created via monitor-add.  Monitors\n> > +# created via CLI options (-mon, -qmp) cannot be removed.  The\n> > +# underlying chardev is NOT removed -- use chardev-remove separately\n> > +# if desired.\n> > +#\n> > +# If a client is currently connected, the connection is dropped.\n> > +#\n> > +# @id: Monitor identifier as passed to monitor-add\n> > +#\n> > +# Errors:\n> > +#     - GenericError if @id does not exist\n> > +#     - GenericError if the monitor was not dynamically added\n> \n> I don't think we need to include \"GenericError\" in the description.\n> We've abandoned the idea of error classes in general, so everything\n> is GenericError  except for a bit of historical cruft.\n\nOk.\n\n> \n> > +#\n> > +# Since: 11.0\n> > +#\n> > +# .. qmp-example::\n> > +#\n> > +#     -> { \"execute\": \"monitor-remove\",\n> > +#          \"arguments\": { \"id\": \"extra-qmp\" } }\n> > +#     <- { \"return\": {} }\n> > +##\n> > +{ 'command': 'monitor-remove',\n> > +  'data': { 'id': 'str' } }\n> > +\n> > +##\n> > +# @MonitorInfo:\n> > +#\n> > +# Information about a QMP/HMP monitor.\n> > +#\n> > +# @id: Monitor identifier (absent for CLI-created monitors without\n> > +#     an explicit id)\n> \n> We can't make 'id' mandatory for the existing arg without breaking\n> compat, but IMHO we should allocate an auto-generated 'id' if the\n> user omits it.\n\nOk.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=Ig7dF6hc;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (unknown [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fqzxW1cRPz1xv0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 07:34:53 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wADYJ-0005Q2-Ta; Tue, 07 Apr 2026 17:01:40 -0400","from eggs.gnu.org ([209.51.188.92])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <brauner@kernel.org>)\n id 1wADYA-0005Op-5g\n for qemu-devel@nongnu.org; Tue, 07 Apr 2026 17:01:32 -0400","from tor.source.kernel.org ([172.105.4.254])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <brauner@kernel.org>)\n id 1wADVv-0001K1-ER\n for qemu-devel@nongnu.org; Tue, 07 Apr 2026 16:59:12 -0400","from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n by tor.source.kernel.org (Postfix) with ESMTP id CBE15600AC;\n Tue,  7 Apr 2026 20:59:10 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 6A646C116C6;\n Tue,  7 Apr 2026 20:59:08 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1775595550;\n bh=m+tZlWT6PpHFvAYmYtrq5ynvY8VedrOo9lnWAeHIrKI=;\n h=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n b=Ig7dF6hcqibZeW771dYZ7twTcwvn4OoFe56i9+h+GNoyuOfp1GFeH1F2uFc5yLL+m\n FbfmYg86D/oro0Wx1pNVzWaYZSlA1bozpjJYnrEOUUdRCAgAQjqDaGMT7O0U6hc+gX\n 5Em/pZN0hKxxowxAdlPlpUIG3bfw/xN9L2u/bGeZnHA78O7HZJZQO2mHI5xVDAVEuh\n 49xiE1X5gE1XtLgJm9f84H4IEwPieI9/SQgPRgAUYBndfVZCIgd97iMzy9tTMl3Z2J\n MbXLAvM9dxi6+5c1nN+USulMdUFpOkGL8FVPe0ZMmh6WU/6p7Wz+YDsopBf3XsBsP5\n A1DiAC8vZgIxg==","Date":"Tue, 7 Apr 2026 22:59:05 +0200","From":"Christian Brauner <brauner@kernel.org>","To":"Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= <berrange@redhat.com>","Cc":"qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,\n  Eric Blake <eblake@redhat.com>, Fabiano Rosas <farosas@suse.de>,\n  Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>,\n  Thomas Huth <th.huth+qemu@posteo.eu>, Philippe =?utf-8?q?Mathieu-Daud?=\n\t=?utf-8?q?=C3=A9?= <philmd@linaro.org>","Subject":"Re: [PATCH v3 3/5] qapi: add monitor-add, monitor-remove,\n query-monitors commands","Message-ID":"<20260407-erhitzen-anlaufen-ffbbd453251b@brauner>","References":"<20260407-work-qmp-monitor-hotplug-v3-0-cb259800fffb@kernel.org>\n <20260407-work-qmp-monitor-hotplug-v3-3-cb259800fffb@kernel.org>\n <adTgYYklczPVA40Q@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<adTgYYklczPVA40Q@redhat.com>","Received-SPF":"pass client-ip=172.105.4.254; envelope-from=brauner@kernel.org;\n helo=tor.source.kernel.org","X-Spam_score_int":"-25","X-Spam_score":"-2.6","X-Spam_bar":"--","X-Spam_report":"(-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}}]