lib/qemu.c: Don't start the guest when checking QMP properties

When checking for QMP properties, we run a qemu command and interact
with the QMP console.  However we also start the guest running (there
is no actual guest in this situation).  This occasionally causes this
line to be printed:

  libguestfs: generic_qmp_test: 3: {"timestamp": {"seconds": 1768823946, "microseconds": 898287}, "event": "GUEST_PANICKED", "data": {"action": "poweroff", "info": {"core": 0, "psw-addr": 0, "reason": "disabled-wait", "psw-mask": 562956395872256, "type": "s390"}}}\r\n

which confuses our parser.

As there is no reason to start the non-existent guest, add the -S
option which causes qemu to start up in a paused state.

For some reason this only happens on s390x but I think it could happen
on all architectures, so it may be a timing issue or something
particular about s390x firmware.
This commit is contained in:
Richard W.M. Jones
2026-01-19 12:00:50 +00:00
parent bbbc982bf5
commit 5da8102f5f

View File

@@ -89,6 +89,7 @@ generic_qmp_test (guestfs_h *g, const char *qmp_command, char **outp)
#endif #endif
"accel=kvm:hvf:tcg"); "accel=kvm:hvf:tcg");
guestfs_int_cmd_add_string_unquoted (cmd, " -qmp stdio"); guestfs_int_cmd_add_string_unquoted (cmd, " -qmp stdio");
guestfs_int_cmd_add_string_unquoted (cmd, " -S");
guestfs_int_cmd_clear_capture_errors (cmd); guestfs_int_cmd_clear_capture_errors (cmd);
fd = guestfs_int_cmd_pipe_run (cmd, "r"); fd = guestfs_int_cmd_pipe_run (cmd, "r");