diff --git a/src/vmspawn/vmspawn-qmp.c b/src/vmspawn/vmspawn-qmp.c index dccf7309cc..b2493dd91c 100644 --- a/src/vmspawn/vmspawn-qmp.c +++ b/src/vmspawn/vmspawn-qmp.c @@ -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), diff --git a/test/units/TEST-87-AUX-UTILS-VM.vmspawn-drives.sh b/test/units/TEST-87-AUX-UTILS-VM.vmspawn-drives.sh index 72b677b085..1e962e3d28 100755 --- a/test/units/TEST-87-AUX-UTILS-VM.vmspawn-drives.sh +++ b/test/units/TEST-87-AUX-UTILS-VM.vmspawn-drives.sh @@ -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"