From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v4 0/9] add hotplug tests and fix uncovered bugs
Date: Fri, 23 Oct 2026 15:01:03 +0200 [thread overview]
Message-ID: <20261023130324.451252-1-d.csapak@proxmox.com> (raw)
Recently it was uncovered that hotplugging scsiX >= 14 does not work
in all situations. Inspired by this, this attempts to add some hotplug
regression tests by simulating the qmp/hmp environment, recording the
calls and testing against some invariants.
This uncovered three additional bugs in the hotplug code:
* hotplugging a tablet device into an aarch64 vm fails
* hot unplugging a tablet device into an aarch64 vm left over the keyboard
* failure to hotplug a disk with iothreads leaves the iothread behind
The series first adds the harness + refactor of shared code from the
cfg2cmd tests, then adds some tests that behave ok, then adds some
tests that show some defect and finally it fixes the two mentioned bugs.
changes from v3:
* dropped the already applied "name the missing bridge" patch
* split the mock and diff helper refactoring into separate patches
* renamed TestsCommon to QemuServerTest
* use PVE::Cmd::run for the diff helper
* initialize the test env defaults in set_test_env()
* new patch: factor out machine expansion, simplifying
resolve_machine_alias()
* use a placeholder for source locations in errors and warnings
* handle K/T size suffixes
* various style fixes and smaller improvements to the harness
* fixed typos in commit messages
changes from v2:
* rebased on current master
* test harness:
- fix swapped labels when reporting devices only present in the
running or the freshly started VM
- don't report USB devices in the mocked 'query-pci' output, like
real QEMU, which uncovered a tablet unplug bug on aarch64
- fail on unexpected errors, even without EXPECTED_ERROR
- fail STAYS_PENDING tests if all changes could be applied
- always generate expected files, also empty ones
- fix in-use check for memory backends ('memdev', not 'memory')
- diff helper: never let differing results pass silently
* move aarch64 'tablet-disable' test into the new fix patch
* new patch: "hotplug: fix hot unplugging tablet on aarch64"
* new patch: "hotplug: name the missing bridge in the error message"
* improve commit messages
changes from v1:
* harness: move shared test code to TestsCommon/, split out diff helper
and use it in run_parse_config_tests.pl too
* harness: simplify expected output, only record actions
* harness: add EXPECTED_ERROR/STAYS_PENDING directives and fail tests
on unexpected errors, differences or pending changes
* harness: die on unknown directives and unexpected config reloads
* harness: resolve machine aliases via windows_get_pinned_machine_version
* harness: model usb-redir chardev removal on unplug
* harness: refactor QMP mock error handling, renames, comment cleanups
* tests: move disk-add-fail into the iothread fix, add scsi-single-fail
* tests: drop obsolete EXPECTED_ERROR from aarch64/tablet-enable
* tests: reorder scsi14 patches, reword known defects commit message
* iothread fix: mention virtio-scsi-single in commit message
Dominik Csapak (9):
tests: factor out useful commandline mocks for reuse
tests: factor out the diff generation
machine: factor out machine expanding
tests: hotplug: add initial hotplug test harness
tests: hotplug: add some test cases
tests: hotplug: add test case for adding scsi14 on qemu 11.1
tests: hotplug: add cases for known defects
hotplug: fix hot unplugging tablet on aarch64
hotplug: remove iothread if adding drive device failed
src/PVE/QemuServer.pm | 47 +-
src/PVE/QemuServer/Machine.pm | 27 +-
src/test/Makefile | 16 +-
src/test/QemuServerTest/CommandLineMocks.pm | 542 +++++++++++
src/test/QemuServerTest/Utils.pm | 31 +
.../aarch64/disk-add-default-machine.conf | 20 +
.../disk-add-default-machine.conf.expected | 6 +
src/test/hotplug/aarch64/disk-add-virtio.conf | 20 +
.../aarch64/disk-add-virtio.conf.expected | 6 +
.../hotplug/aarch64/net-add-pci-bridge.conf | 20 +
.../aarch64/net-add-pci-bridge.conf.expected | 5 +
src/test/hotplug/aarch64/net-add.conf | 20 +
.../hotplug/aarch64/net-add.conf.expected | 5 +
src/test/hotplug/aarch64/tablet-disable.conf | 20 +
.../aarch64/tablet-disable.conf.expected | 2 +
src/test/hotplug/aarch64/tablet-enable.conf | 21 +
.../aarch64/tablet-enable.conf.expected | 2 +
.../hotplug/aarch64/x86-guest-net-add.conf | 18 +
.../aarch64/x86-guest-net-add.conf.expected | 5 +
src/test/hotplug/agent-fstrim.conf | 17 +
src/test/hotplug/agent-fstrim.conf.expected | 0
src/test/hotplug/balloon.conf | 18 +
src/test/hotplug/balloon.conf.expected | 1 +
src/test/hotplug/cdrom-eject.conf | 17 +
src/test/hotplug/cdrom-eject.conf.expected | 4 +
src/test/hotplug/cpu-add-too-many.conf | 20 +
.../hotplug/cpu-add-too-many.conf.expected | 0
src/test/hotplug/cpu-add.conf | 18 +
src/test/hotplug/cpu-add.conf.expected | 2 +
src/test/hotplug/cpu-remove.conf | 18 +
src/test/hotplug/cpu-remove.conf.expected | 2 +
src/test/hotplug/cpulimit.conf | 16 +
src/test/hotplug/cpulimit.conf.expected | 1 +
.../hotplug/disk-add-default-machine.conf | 16 +
.../disk-add-default-machine.conf.expected | 6 +
src/test/hotplug/disk-add-fail.conf | 19 +
src/test/hotplug/disk-add-fail.conf.expected | 9 +
src/test/hotplug/disk-add-legacy-drive.conf | 16 +
.../disk-add-legacy-drive.conf.expected | 3 +
.../hotplug/disk-add-scsi-single-fail.conf | 19 +
.../disk-add-scsi-single-fail.conf.expected | 4 +
src/test/hotplug/disk-add-scsi-single.conf | 16 +
.../disk-add-scsi-single.conf.expected | 7 +
src/test/hotplug/disk-add-scsi14-old.conf | 17 +
.../hotplug/disk-add-scsi14-old.conf.expected | 1 +
.../hotplug/disk-add-scsi14-qemu11.1.conf | 15 +
.../disk-add-scsi14-qemu11.1.conf.expected | 6 +
src/test/hotplug/disk-add-virtio.conf | 16 +
.../hotplug/disk-add-virtio.conf.expected | 6 +
src/test/hotplug/disk-remove-bootdisk.conf | 18 +
.../disk-remove-bootdisk.conf.expected | 0
src/test/hotplug/disk-remove-busy.conf | 20 +
.../hotplug/disk-remove-busy.conf.expected | 1 +
src/test/hotplug/disk-remove-scsi-single.conf | 17 +
.../disk-remove-scsi-single.conf.expected | 5 +
src/test/hotplug/disk-remove-virtio.conf | 17 +
.../hotplug/disk-remove-virtio.conf.expected | 4 +
src/test/hotplug/disk-skip-ide.conf | 17 +
src/test/hotplug/disk-skip-ide.conf.expected | 0
src/test/hotplug/disk-throttle.conf | 16 +
src/test/hotplug/disk-throttle.conf.expected | 1 +
src/test/hotplug/fast-plug.conf | 17 +
src/test/hotplug/fast-plug.conf.expected | 0
src/test/hotplug/memory-add.conf | 18 +
src/test/hotplug/memory-add.conf.expected | 4 +
src/test/hotplug/memory-remove.conf | 18 +
src/test/hotplug/memory-remove.conf.expected | 4 +
src/test/hotplug/net-add-fail.conf | 19 +
src/test/hotplug/net-add-fail.conf.expected | 5 +
src/test/hotplug/net-add-pci-bridge.conf | 16 +
.../hotplug/net-add-pci-bridge.conf.expected | 5 +
src/test/hotplug/net-add.conf | 16 +
src/test/hotplug/net-add.conf.expected | 5 +
src/test/hotplug/net-change-bridge.conf | 16 +
.../hotplug/net-change-bridge.conf.expected | 6 +
src/test/hotplug/net-change-model.conf | 16 +
.../hotplug/net-change-model.conf.expected | 8 +
src/test/hotplug/net-change-rate.conf | 16 +
.../hotplug/net-change-rate.conf.expected | 1 +
src/test/hotplug/net-hotplug-disabled.conf | 18 +
.../net-hotplug-disabled.conf.expected | 0
src/test/hotplug/net-remove.conf | 17 +
src/test/hotplug/net-remove.conf.expected | 3 +
src/test/hotplug/tablet-disable.conf | 16 +
src/test/hotplug/tablet-disable.conf.expected | 1 +
src/test/hotplug/tablet-enable.conf | 17 +
src/test/hotplug/tablet-enable.conf.expected | 1 +
src/test/hotplug/usb-add-spice.conf | 17 +
src/test/hotplug/usb-add-spice.conf.expected | 2 +
src/test/hotplug/usb-add.conf | 16 +
src/test/hotplug/usb-add.conf.expected | 2 +
src/test/hotplug/usb-remove-last.conf | 17 +
.../hotplug/usb-remove-last.conf.expected | 2 +
src/test/run_config2command_tests.pl | 553 +-----------
src/test/run_hotplug_tests.pl | 842 ++++++++++++++++++
src/test/run_parse_config_tests.pl | 25 +-
96 files changed, 2426 insertions(+), 572 deletions(-)
create mode 100644 src/test/QemuServerTest/CommandLineMocks.pm
create mode 100644 src/test/QemuServerTest/Utils.pm
create mode 100644 src/test/hotplug/aarch64/disk-add-default-machine.conf
create mode 100644 src/test/hotplug/aarch64/disk-add-default-machine.conf.expected
create mode 100644 src/test/hotplug/aarch64/disk-add-virtio.conf
create mode 100644 src/test/hotplug/aarch64/disk-add-virtio.conf.expected
create mode 100644 src/test/hotplug/aarch64/net-add-pci-bridge.conf
create mode 100644 src/test/hotplug/aarch64/net-add-pci-bridge.conf.expected
create mode 100644 src/test/hotplug/aarch64/net-add.conf
create mode 100644 src/test/hotplug/aarch64/net-add.conf.expected
create mode 100644 src/test/hotplug/aarch64/tablet-disable.conf
create mode 100644 src/test/hotplug/aarch64/tablet-disable.conf.expected
create mode 100644 src/test/hotplug/aarch64/tablet-enable.conf
create mode 100644 src/test/hotplug/aarch64/tablet-enable.conf.expected
create mode 100644 src/test/hotplug/aarch64/x86-guest-net-add.conf
create mode 100644 src/test/hotplug/aarch64/x86-guest-net-add.conf.expected
create mode 100644 src/test/hotplug/agent-fstrim.conf
create mode 100644 src/test/hotplug/agent-fstrim.conf.expected
create mode 100644 src/test/hotplug/balloon.conf
create mode 100644 src/test/hotplug/balloon.conf.expected
create mode 100644 src/test/hotplug/cdrom-eject.conf
create mode 100644 src/test/hotplug/cdrom-eject.conf.expected
create mode 100644 src/test/hotplug/cpu-add-too-many.conf
create mode 100644 src/test/hotplug/cpu-add-too-many.conf.expected
create mode 100644 src/test/hotplug/cpu-add.conf
create mode 100644 src/test/hotplug/cpu-add.conf.expected
create mode 100644 src/test/hotplug/cpu-remove.conf
create mode 100644 src/test/hotplug/cpu-remove.conf.expected
create mode 100644 src/test/hotplug/cpulimit.conf
create mode 100644 src/test/hotplug/cpulimit.conf.expected
create mode 100644 src/test/hotplug/disk-add-default-machine.conf
create mode 100644 src/test/hotplug/disk-add-default-machine.conf.expected
create mode 100644 src/test/hotplug/disk-add-fail.conf
create mode 100644 src/test/hotplug/disk-add-fail.conf.expected
create mode 100644 src/test/hotplug/disk-add-legacy-drive.conf
create mode 100644 src/test/hotplug/disk-add-legacy-drive.conf.expected
create mode 100644 src/test/hotplug/disk-add-scsi-single-fail.conf
create mode 100644 src/test/hotplug/disk-add-scsi-single-fail.conf.expected
create mode 100644 src/test/hotplug/disk-add-scsi-single.conf
create mode 100644 src/test/hotplug/disk-add-scsi-single.conf.expected
create mode 100644 src/test/hotplug/disk-add-scsi14-old.conf
create mode 100644 src/test/hotplug/disk-add-scsi14-old.conf.expected
create mode 100644 src/test/hotplug/disk-add-scsi14-qemu11.1.conf
create mode 100644 src/test/hotplug/disk-add-scsi14-qemu11.1.conf.expected
create mode 100644 src/test/hotplug/disk-add-virtio.conf
create mode 100644 src/test/hotplug/disk-add-virtio.conf.expected
create mode 100644 src/test/hotplug/disk-remove-bootdisk.conf
create mode 100644 src/test/hotplug/disk-remove-bootdisk.conf.expected
create mode 100644 src/test/hotplug/disk-remove-busy.conf
create mode 100644 src/test/hotplug/disk-remove-busy.conf.expected
create mode 100644 src/test/hotplug/disk-remove-scsi-single.conf
create mode 100644 src/test/hotplug/disk-remove-scsi-single.conf.expected
create mode 100644 src/test/hotplug/disk-remove-virtio.conf
create mode 100644 src/test/hotplug/disk-remove-virtio.conf.expected
create mode 100644 src/test/hotplug/disk-skip-ide.conf
create mode 100644 src/test/hotplug/disk-skip-ide.conf.expected
create mode 100644 src/test/hotplug/disk-throttle.conf
create mode 100644 src/test/hotplug/disk-throttle.conf.expected
create mode 100644 src/test/hotplug/fast-plug.conf
create mode 100644 src/test/hotplug/fast-plug.conf.expected
create mode 100644 src/test/hotplug/memory-add.conf
create mode 100644 src/test/hotplug/memory-add.conf.expected
create mode 100644 src/test/hotplug/memory-remove.conf
create mode 100644 src/test/hotplug/memory-remove.conf.expected
create mode 100644 src/test/hotplug/net-add-fail.conf
create mode 100644 src/test/hotplug/net-add-fail.conf.expected
create mode 100644 src/test/hotplug/net-add-pci-bridge.conf
create mode 100644 src/test/hotplug/net-add-pci-bridge.conf.expected
create mode 100644 src/test/hotplug/net-add.conf
create mode 100644 src/test/hotplug/net-add.conf.expected
create mode 100644 src/test/hotplug/net-change-bridge.conf
create mode 100644 src/test/hotplug/net-change-bridge.conf.expected
create mode 100644 src/test/hotplug/net-change-model.conf
create mode 100644 src/test/hotplug/net-change-model.conf.expected
create mode 100644 src/test/hotplug/net-change-rate.conf
create mode 100644 src/test/hotplug/net-change-rate.conf.expected
create mode 100644 src/test/hotplug/net-hotplug-disabled.conf
create mode 100644 src/test/hotplug/net-hotplug-disabled.conf.expected
create mode 100644 src/test/hotplug/net-remove.conf
create mode 100644 src/test/hotplug/net-remove.conf.expected
create mode 100644 src/test/hotplug/tablet-disable.conf
create mode 100644 src/test/hotplug/tablet-disable.conf.expected
create mode 100644 src/test/hotplug/tablet-enable.conf
create mode 100644 src/test/hotplug/tablet-enable.conf.expected
create mode 100644 src/test/hotplug/usb-add-spice.conf
create mode 100644 src/test/hotplug/usb-add-spice.conf.expected
create mode 100644 src/test/hotplug/usb-add.conf
create mode 100644 src/test/hotplug/usb-add.conf.expected
create mode 100644 src/test/hotplug/usb-remove-last.conf
create mode 100644 src/test/hotplug/usb-remove-last.conf.expected
create mode 100644 src/test/run_hotplug_tests.pl
--
2.47.3
next reply other threads:[~2026-10-23 13:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 13:01 Dominik Csapak [this message]
2026-10-23 13:01 ` [PATCH qemu-server v4 1/9] tests: factor out useful commandline mocks for reuse Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 2/9] tests: factor out the diff generation Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 3/9] machine: factor out machine expanding Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 4/9] tests: hotplug: add initial hotplug test harness Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 5/9] tests: hotplug: add some test cases Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 6/9] tests: hotplug: add test case for adding scsi14 on qemu 11.1 Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 7/9] tests: hotplug: add cases for known defects Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 8/9] hotplug: fix hot unplugging tablet on aarch64 Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 9/9] hotplug: remove iothread if adding drive device failed Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261023130324.451252-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox