Qemu will refuse to start on some (all?) architectures if firmware
files are missing, or for other reasons, and complain to stderr. Those
messages should be made visible to the user as part of the error message.
---
lib/qemu.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/qemu.c b/lib/qemu.c
index 9edbe8208..483b772a4 100644
--- a/lib/qemu.c
+++ b/lib/qemu.c
@@ -68,6 +68,7 @@ generic_qmp_test (guestfs_h *g, const char *qmp_command, char **outp)
size_t allocsize = 0;
ssize_t len;
unsigned lineno;
+ CLEANUP_FREE_STRING_LIST char **err_lines = NULL;
guestfs_int_cmd_add_string_unquoted (cmd, "echo ");
/* QMP is modal. You have to send the qmp_capabilities command first. */
@@ -109,6 +110,11 @@ generic_qmp_test (guestfs_h *g, const char *qmp_command, char
**outp)
if (len == -1 || strstr (line, "\"QMP\"") == NULL) {
parse_failure:
error (g, "did not understand QMP monitor output from %s", g->hv);
+ output_stderr:
+ err_lines = guestfs_int_split_string ('\n', guestfs_int_cmd_get_pipe_errors
(cmd));
+ if (err_lines) error (g, "stderr from %s:", g->hv);
+ for (int i=0; err_lines[i]; i++)
+ error (g, "%s", err_lines[i]);
return -1;
}
@@ -134,7 +140,7 @@ generic_qmp_test (guestfs_h *g, const char *qmp_command, char **outp)
/* QMP tests are optional, don't fail if the tests fail. */
if (r == -1 || !WIFEXITED (r) || WEXITSTATUS (r) != 0) {
error (g, "%s wait failed or unexpected exit status", g->hv);
- return -1;
+ goto output_stderr;
}
return 0;
--
2.47.3