vmspawn: actually enable io_uring for disks

vmspawn never used `aio=io_uring` for disks, even when QEMU supports it.
Commit 1a7b6fd9dd added a blockdev probe node named `__io_uring_probe`.
QEMU rejects that name ("Invalid node-name"), as node names have to
start with a letter. The probe then reported io_uring as unsupported.

Use a valid name, following the "vmspawn-" prefix of the other node names.
Check the multi-drive test's debug log for rejected node names to catch
this and similar issues in the future.

Signed-off-by: Martin Pitt <martin@amutable.com>
(cherry picked from commit 9c582182e1ae1e38b7ec2dca29bb279cae83e69b)
This commit is contained in:
Martin Pitt
2026-10-16 11:36:32 +01:00
committed by Luca Boccassi
parent e7dc2168e7
commit a9868c9800
2 changed files with 16 additions and 3 deletions
+5 -2
View File
@@ -1758,6 +1758,9 @@ QmpClient* vmspawn_qmp_bridge_get_qmp(VmspawnQmpBridge *b) {
* are best-effort — failing to delete a private probe node leaves a harmless /dev/null
* blockdev in QEMU until it exits. */
/* QEMU node names must start with a letter. */
#define IO_URING_PROBE_NODE_NAME "vmspawn-io-uring-probe"
static int on_io_uring_probe_del_reply(
QmpClient *c,
sd_json_variant *result,
@@ -1797,7 +1800,7 @@ static int on_io_uring_probe_add_reply(
/* Best-effort cleanup; the chained reply keeps the pump busy via the slots set. */
r = sd_json_buildo(&del_args,
SD_JSON_BUILD_PAIR_STRING("node-name", "__io_uring_probe"));
SD_JSON_BUILD_PAIR_STRING("node-name", IO_URING_PROBE_NODE_NAME));
if (r < 0)
return r;
@@ -1814,7 +1817,7 @@ static int probe_io_uring(QmpClient *c, VmspawnQmpBridge *bridge) {
r = sd_json_buildo(
&args,
SD_JSON_BUILD_PAIR_STRING("node-name", "__io_uring_probe"),
SD_JSON_BUILD_PAIR_STRING("node-name", IO_URING_PROBE_NODE_NAME),
SD_JSON_BUILD_PAIR_STRING("driver", "file"),
SD_JSON_BUILD_PAIR_STRING("filename", "/dev/null"),
SD_JSON_BUILD_PAIR_BOOLEAN("read-only", true),
@@ -90,7 +90,8 @@ truncate -s 32M "$WORKDIR/extra2.raw"
# three device_add commands — all pipelined without waiting for responses.
MACHINE_MULTI="test-vmspawn-drives-$$"
systemd-vmspawn \
# Debug logging shows QEMU's replies to the feature probes, see the node name check below.
SYSTEMD_LOG_LEVEL=debug systemd-vmspawn \
--machine="$MACHINE_MULTI" \
--ram=256M \
--image="$WORKDIR/root.raw" \
@@ -123,6 +124,15 @@ if grep -E '(add-fd|blockdev-add|blockdev-create|device_add|getfd|netdev_add|cha
fi
echo "No QMP device setup errors in log"
# Probe failures are expected and only logged at debug level, but a rejected node name
# makes a probe fail regardless of QEMU's features.
if grep -a 'Invalid node-name' "$WORKDIR/vmspawn-multi.log"; then
echo "Full vmspawn log:"
cat "$WORKDIR/vmspawn-multi.log"
exit 1
fi
echo "QEMU accepted all node names"
machinectl terminate "$MACHINE_MULTI"
timeout 10 bash -c "while machinectl status '$MACHINE_MULTI' &>/dev/null; do sleep .5; done"
timeout 10 bash -c "while kill -0 '$VMSPAWN_MULTI_PID' 2>/dev/null; do sleep .5; done"