feat(proxmox): give guest disks a dedicated IO thread - #352
Merged
Conversation
VMs were created with the `virtio-scsi-pci` controller and no iothread, so every guest's block IO was serialised through the main QEMU event loop alongside device emulation and networking. That caps a guest at roughly one thread of storage throughput no matter how fast the host pool is — measured ~250 MiB/s in-guest against a pool benchmarking at 8+ GB/s aggregate. Switch `scsihw` to `virtio-scsi-single` (the only SCSI controller type that supports iothreads) and set `iothread=1` on scsi0, both at import time and in the config reconcile path. `apply_disk_limits` is renamed to `apply_disk_options` and no longer returns early when a template carries no throttle limits, otherwise VMs without limits would never converge onto `iothread=1`. Existing VMs pick this up on the next config reconcile; the controller change only takes effect at VM start, so a running VM keeps its old behaviour until stopped and started. qemu-server warns and ignores `iothread` on other controller types, so a VM caught mid-transition is never invalid.
v0l
force-pushed
the
feat/iothread-virtio-scsi-single
branch
from
August 2, 2026 18:29
e427264 to
0cfc90c
Compare
v0l
enabled auto-merge (squash)
August 2, 2026 18:30
v0l
disabled auto-merge
August 2, 2026 18:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every VM is created with
scsihw: virtio-scsi-pciand noiothread, so all guest block IO is serialised through QEMU's main event loop — the same thread that services device emulation and networking. That caps a guest at roughly one thread's worth of storage throughput regardless of how fast the host pool actually is.Measured on a production host (R740xd, 12x U.2 NVMe):
The drives are healthy (2–3% wear after 4.3 years, 100% spare, 23°C) and the pool is at ~0.4% of its IOPS capability. The bottleneck was entirely the guest disk configuration.
On the affected host: 0 of 70 VMs had
iothread=1, and 68 of 71 usedvirtio-scsi-pci, which cannot support it.Change
make_confignow emitsscsihw: virtio-scsi-single— the only SCSI controller type qemu-server accepts iothreads on.import_disk_imageaddsiothread=1to the scsi0 device string at VM creation.apply_disk_limits→apply_disk_options, and it no longer returns early when a template has no throttle limits. Without that, VMs without limits would never converge ontoiothread=1.Rollout behaviour
Existing VMs pick up the new settings the next time their config is reconciled. A SCSI controller change only takes effect at VM start, so an already-running VM keeps its current behaviour until it is stopped and started — a guest-initiated reboot is not enough. No mass restart is triggered by this PR.
Mid-transition VMs are safe:
qemu-serverwarns and ignoresiothreadon controllers other thanvirtio-scsi-singlerather than erroring —So a VM whose config has
iothread=1but is still running the old controller simply ignores the flag until its next start.Tests
test_make_config_uses_virtio_scsi_single— guards the controller/iothread pairing from drifting apart.test_apply_disk_options_sets_iothread_without_limits— covers the removed early-return; asserts a PATCH is still issued and the bare volume ref is preserved.test_apply_disk_options_preserves_ssd_params— existing regression test, extended to assertiothread=1.cargo test -p lnvps_api_common --features proxmox→ 359 passed, 0 failed.cargo clippyandcargo fmt --checkclean.API impact
None — no request or response shape changed. Documented in
API_CHANGELOG.mdunder Unreleased.