diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2024-08-27 15:27:50 -0400 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2024-11-25 11:03:42 +0100 |
commit | be93fd53723cbdca675bd9ed112dae5cabbe1e91 (patch) | |
tree | 51190f71725813bba3f6ef3899f917384f929e2f /hw | |
parent | 770de685353e8c495ad4773fbd4bc0db997e4dfd (diff) | |
download | qemu-be93fd53723cbdca675bd9ed112dae5cabbe1e91.zip qemu-be93fd53723cbdca675bd9ed112dae5cabbe1e91.tar.gz qemu-be93fd53723cbdca675bd9ed112dae5cabbe1e91.tar.bz2 |
qdev-monitor: avoid QemuOpts in QMP device_add
The QMP device_add monitor command converts the QDict arguments to
QemuOpts and then back again to QDict. This process only supports scalar
types. Device properties like virtio-blk-pci's iothread-vq-mapping (an
array of objects) are silently dropped by qemu_opts_from_qdict() during
the QemuOpts conversion even though QAPI is capable of validating them.
As a result, hotplugging virtio-blk-pci devices with the
iothread-vq-mapping property does not work as expected (the property is
ignored).
Get rid of the QemuOpts conversion in qmp_device_add() and call
qdev_device_add_from_qdict() with from_json=true. Using the QMP
command's QDict arguments directly allows non-scalar properties.
The HMP is also adjusted since qmp_device_add()'s now expects properly
typed JSON arguments and cannot be used from HMP anymore. Move the code
that was previously in qmp_device_add() (with QemuOpts conversion and
from_json=false) into hmp_device_add() so that its behavior is
unchanged.
This patch changes the behavior of QMP device_add but not HMP
device_add. QMP clients that sent incorrectly typed device_add QMP
commands no longer work. This is a breaking change but clients should be
using the correct types already. See the netdev_add QAPIfication in
commit db2a380c8457 for similar reasoning and object-add in commit
9151e59a8b6e. Unlike those commits, we continue to rely on 'gen': false
for the time being.
Markus helped me figure this out and even provided a draft patch. The
code ended up very close to what he suggested.
Suggested-by: Markus Armbruster <armbru@redhat.com>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240827192751.948633-2-stefanha@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw')
0 files changed, 0 insertions, 0 deletions