qemu-server/PVE/QemuServer
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
..
Agent.pm tree wide cleanup of s/return undef/return/ 2020-10-16 16:20:05 +02:00
CGroup.pm fix #5528: override cgroup methods to call systemd via dbus 2024-07-23 08:05:53 +02:00
Cloudinit.pm cloud-init: commit disk: use volume format from storage layer 2024-12-09 09:07:17 +01:00
CPUConfig.pm config: add AMD SEV support 2024-11-18 21:26:39 +01:00
Drive.pm drive: commandline info: re-use drive_id variable in error message 2025-01-20 11:20:55 +01:00
Helpers.pm move get_vm_arch() helper to helpers module 2025-01-17 19:24:02 +01:00
ImportDisk.pm import: add source size parameter to do_import() 2024-12-09 09:07:17 +01:00
Machine.pm machine: code cleanup: avoid superfluous augmented assignment operator 2025-01-17 19:24:02 +01:00
Makefile move meta information handling to its own module 2025-01-17 19:24:02 +01:00
Memory.pm tree-wide: fix various typos in comments 2024-12-05 12:33:24 +01:00
MetaInfo.pm move meta information handling to its own module 2025-01-17 19:24:02 +01:00
Monitor.pm monitor: allow passing timeout for a HMP command 2024-06-11 13:56:44 +02:00
PCI.pm tree-wide: fix various typos in comments 2024-12-05 12:33:24 +01:00
QMPHelpers.pm qmp helpers: device add/del: use HMP interface 2025-02-04 17:07:19 +01:00
USB.pm fix typos in user-visible strings 2024-10-24 13:15:06 +02:00