[Libguestfs] [PATCH] lib: direct: Set QEMU_AUDIO_DRV=none when testing schema.

Richard W.M. Jones rjones at redhat.com
Sat Mar 23 18:11:21 UTC 2019


Schema parsing was failing with errors such as:

libguestfs: QMP parse error: '[' or '{' expected near end of file (ignored)

This happened because the QMP command was actually completely failing
and never printing a result at all.  This happens because the qemu
audio driver can't be set up without a console.  We can suppress this
by setting the environment variable QEMU_AUDIO_DRV=none, which is the
same thing that libvirt does, and also the same thing that we are
already doing when launching the real appliance subprocess.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=1692047
---
 lib/qemu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/qemu.c b/lib/qemu.c
index 10bb83105..2f3493217 100644
--- a/lib/qemu.c
+++ b/lib/qemu.c
@@ -566,6 +566,7 @@ generic_qmp_test (guestfs_h *g, struct qemu_data *data,
   /* Exit QEMU after sending the commands. */
   guestfs_int_cmd_add_string_unquoted (cmd, "'{ \"execute\": \"quit\" }' ");
   guestfs_int_cmd_add_string_unquoted (cmd, " | ");
+  guestfs_int_cmd_add_string_unquoted (cmd, "QEMU_AUDIO_DRV=none ");
   guestfs_int_cmd_add_string_quoted (cmd, g->hv);
   guestfs_int_cmd_add_string_unquoted (cmd, " -display none");
   guestfs_int_cmd_add_string_unquoted (cmd, " -machine ");
-- 
2.21.0




More information about the Libguestfs mailing list