{"id":2219329,"url":"http://patchwork.ozlabs.org/api/1.0/covers/2219329/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260402-work-qmp-monitor-hotplug-v1-0-6313a5cdd574@kernel.org>","date":"2026-04-02T21:19:15","name":"[0/5] monitor: add dynamic QMP monitor hotplug support","submitter":{"id":82326,"url":"http://patchwork.ozlabs.org/api/1.0/people/82326/?format=json","name":"Christian Brauner","email":"brauner@kernel.org"},"series":[{"id":498554,"url":"http://patchwork.ozlabs.org/api/1.0/series/498554/?format=json","date":"2026-04-02T21:19:15","name":"monitor: add dynamic QMP monitor hotplug support","version":1,"mbox":"http://patchwork.ozlabs.org/series/498554/mbox/"}],"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=TxUdEPvb;\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 (lists.gnu.org [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 4fmvry2LGfz1yDH\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 08:20:16 +1100 (AEDT)","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 1w8PS2-0003jA-Bf; Thu, 02 Apr 2026 17:19:42 -0400","from eggs.gnu.org ([2001:470:142:3::10])\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 1w8PS1-0003ir-Gc\n for qemu-devel@nongnu.org; Thu, 02 Apr 2026 17:19:41 -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 1w8PRz-0004aV-OW\n for qemu-devel@nongnu.org; Thu, 02 Apr 2026 17:19:41 -0400","from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n by tor.source.kernel.org (Postfix) with ESMTP id 6B0A760008;\n Thu,  2 Apr 2026 21:19:30 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id E6D8AC116C6;\n Thu,  2 Apr 2026 21:19:27 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1775164770;\n bh=eNz4TXeQwYYgzP9FaqhnGrCXXRK7/qAMuiJdSkNwQv4=;\n h=From:Subject:Date:To:Cc:From;\n b=TxUdEPvbekbNd6XvuhhwHAZjQNaY2r9aO8C4MFOakkkTWeNIR2iMfccDXjoVGQAvs\n uUH8Alqgn78BMC7EhBdh68u7s8DoCEVnB62+9T2EXVdkNLAqLedZPrBOihQsdWitvk\n nu60kLCpMDZHw9IpG8tAhSTE4w78/SPRy4dafz+MYaotFL7d7DHQFTWROf4xRFSkuy\n gwGB+lfzBXfNeHgYl5pKMSnOgTdpJT5SdTmBowj+wTZYUMWi9nVlCrMOjnECcytIqn\n qbuxMQYocrHyLIQ1FF6NemxtvtnzWStMK5M5QZl5urMuMpPwP3w+MjJOam7wb0M5p2\n YFKrGTeCqsB1w==","From":"Christian Brauner <brauner@kernel.org>","Subject":"[PATCH 0/5] monitor: add dynamic QMP monitor hotplug support","Date":"Thu, 02 Apr 2026 23:19:15 +0200","Message-Id":"<20260402-work-qmp-monitor-hotplug-v1-0-6313a5cdd574@kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","X-B4-Tracking":"v=1; b=H4sIAFPdzmkC/yWMyw7CIBBFf6WZtZNQNNX4K8YF0GlB5eFA1aTpv\n wu6PDf3nBUysaMM524FppfLLoYK/a4DY1WYCd1YGaSQgzgIie/Id3z6hD4GVyKjjSU9lhknrY5\n m6E+0HzVUPTFN7vNLX65/zou+kSmt1x5aZULNKhjbJq9yIYZt+wKAziXmlQAAAA==","X-Change-ID":"20260402-work-qmp-monitor-hotplug-fba7c618e3db","To":"qemu-devel@nongnu.org","Cc":"Markus Armbruster <armbru@redhat.com>, Eric Blake <eblake@redhat.com>,\n  Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>,\n  Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <th.huth+qemu@posteo.eu>,\n\t=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, =?utf-8?q?Dani?=\n\t=?utf-8?q?el_P=2E_Berrang=C3=A9?= <berrange@redhat.com>,\n  Christian Brauner <brauner@kernel.org>","X-Mailer":"b4 0.16-dev","X-Developer-Signature":"v=1; a=openpgp-sha256; l=3299; i=brauner@kernel.org;\n h=from:subject:message-id; bh=eNz4TXeQwYYgzP9FaqhnGrCXXRK7/qAMuiJdSkNwQv4=;\n b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWSeuxsfNnPG3tz26n6m8ED+O9k39EzeJO1/kOHHkLjm1\n YIFQmkfO0pZGMS4GGTFFFkc2k3C5ZbzVGw2ytSAmcPKBDKEgYtTACYisJaRYWdT5ja2F7xv+1mD\n pp/bJH7x/p5d75aJ7945z/LquqRtl00ZGY5f9b2WWTYped60VPm2Xyxc+7rClmdZ5gs9+nfUIkf\n rLSMA","X-Developer-Key":"i=brauner@kernel.org; a=openpgp;\n fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624","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.542,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,\n RCVD_IN_VALIDITY_RPBL_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"},"content":"QEMU supports runtime hotplug for chardevs, devices, block backends,\nand netdevs. Monitors are the only major subsystem that lacks this --\nall QMP monitors must be configured at launch via -mon or -qmp CLI\noptions.\n\nThis series adds monitor-add, monitor-remove, and query-monitors QMP\ncommands so that management tools can create independent QMP sessions\non demand at runtime.\n\nI've currently implemented a bridge that bridges QMP and Varlink in\nsystemd. This allows sytemd-vmspawn to control virtual machines and\ncontainers through a unified Varlink interface. Varlink allows protocol\nupgrades. For example, it is possible to switch from Varlink to say\nhttp. I'm allow Varlink clients to upgrade from the Varlink interfact to\nthe native QMP interface. Such clients get a new monitor assigned that\nallows them to manage the virtual machine directly via QMP. The main\nmonitor remains unaffected and tied to the generic Varlink interface.\nWe can't pre-allocate monitors as we have no control over how many\nprotocol upgrades we actually get but it won't just be one. And having\nunused monitors around really isn't ideal either.\n\nHaving the ability to hotplug monitors would really be helpful. I'm not\nyet super well-versed in qemu internals so this might be done wrong but\ntesting works so far.\n\nMy systemd patch that triggerd this is at\nhttps://github.com/systemd/systemd/pull/41449.\n\nThe usage pattern mirrors chardev hotplug:\n\n  -> chardev-add id=qmp-extra backend=socket,...\n  -> monitor-add id=extra-qmp chardev=qmp-extra\n  [client connects to socket, gets QMP greeting, negotiates, sends commands]\n  -> monitor-remove id=extra-qmp\n  -> chardev-remove id=qmp-extra\n\nPatches 1-2 add the data model (id/dynamic/dead fields in Monitor) and\nthe infrastructure for safe per-monitor destruction without shutting\ndown the shared dispatcher coroutine.\n\nPatch 3 adds the QAPI schema and command handlers.\n\nPatches 4-5 add qtest unit tests and a functional e2e test that\nperforms a full hotplug -> connect -> handshake -> unplug cycle.\n\nSigned-off-by: Christian Brauner <brauner@kernel.org>\n---\nChristian Brauner (5):\n      monitor: store monitor id and dynamic flag in Monitor struct\n      monitor/qmp: add infrastructure for safe dynamic monitor removal\n      qapi: add monitor-add, monitor-remove, query-monitors commands\n      tests/qtest: add tests for dynamic monitor add/remove\n      tests/functional: add e2e test for dynamic QMP monitor hotplug\n\n include/monitor/monitor.h                        |   3 +-\n monitor/monitor-internal.h                       |   8 ++\n monitor/monitor.c                                |  15 +++-\n monitor/qmp-cmds-control.c                       |  94 ++++++++++++++++++++\n monitor/qmp.c                                    |  41 ++++++++-\n qapi/control.json                                | 106 +++++++++++++++++++++++\n tests/functional/generic/meson.build             |   1 +\n tests/functional/generic/test_monitor_hotplug.py | 102 ++++++++++++++++++++++\n tests/qtest/qmp-test.c                           | 101 +++++++++++++++++++++\n 9 files changed, 467 insertions(+), 4 deletions(-)\n---\nbase-commit: b6a7d06213e5d2f7d124d16418bc289c4a8a4b82\nchange-id: 20260402-work-qmp-monitor-hotplug-fba7c618e3db"}