qemu-server/PVE
Fiona Ebner 48333b4d6a qmp helpers: device add/del: use HMP interface
Fixes device hotplug in combination with QEMU 9.2.

QEMU commit be93fd5372 ("qdev-monitor: avoid QemuOpts in QMP device_add")
notes:

> 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.

The qemu_deviceadd() helper does not have the required type
information right now, so switch to using HMP, which still behaves the
same when passing a device commandline string. QEMU commit be93fd5372
fixes passing in complex properties via JSON, but the qemu_deviceadd()
helper never uses any such, as it already only received a string (and
naively split it up).

Use HMP for 'device_del' too, simply to keep the qemu_deviceadd() and
qemu_devicedel() helpers consistent.

Switching back to QMP using the correct types in the JSON can still be
done later. Unfortunately, 'qmp-query-schema' does not provide
device-specific types, so another way is needed.

A timeout of 25 seconds is used rather then relying on the low default
like before, since device plug operations require actions by the guest
kernel and might require IO. Device plug is often an interactive
operation, so a too high timeout could lead to bad UX. For now stay a
few seconds under the default timeout of 30 seconds of our web UI's
API request handler. Should specific devices need a higher timeout, it
can still be increased further for them in the future.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 [TL: reduce timeout from 30s to 25s to ensure sync API requests
      (without a task worker) do not run into the frontend timeout]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-02-04 17:07:19 +01:00
..
API2 api: fix ova live import by using correct format for source image 2025-01-20 18:49:41 +01:00
CLI fix #5980: importdisk: fix spurious warning 2024-12-09 19:46:03 +01:00
QemuServer qmp helpers: device add/del: use HMP interface 2025-02-04 17:07:19 +01:00
VZDump backup: prepare: use volume format from storage layer 2024-12-09 09:07:17 +01:00
Makefile buildsys: use $(MAKE) instead of make 2019-09-24 18:06:16 +02:00
QemuConfig.pm migration: add check_non_migratable_resources function 2024-11-18 21:26:39 +01:00
QemuMigrate.pm migration: remote phase one: use volume format from storage layer 2024-12-09 09:07:17 +01:00
QemuServer.pm print drive commandline: code cleanup 2025-01-20 11:20:55 +01:00
QMPClient.pm tree-wide: fix various typos in comments 2024-12-05 12:33:24 +01:00