Richard W.M. Jones
2019-Mar-23 18:11 UTC
[Libguestfs] [PATCH] lib: direct: Set QEMU_AUDIO_DRV=none when testing schema.
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
Pino Toscano
2019-Mar-27 11:50 UTC
Re: [Libguestfs] [PATCH] lib: direct: Set QEMU_AUDIO_DRV=none when testing schema.
On Saturday, 23 March 2019 19:11:21 CET Richard W.M. Jones wrote:> 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 > ---LGTM. -- Pino Toscano
Reasonably Related Threads
- [PATCH v2 3/5] lib: qemu: Run QMP ‘query-commands’, ‘query-qmp-schema’ against the qemu binary.
- [PATCH 6/6] lib: Use guestfs_int_make_temp_path in a few more places.
- [PATCH v2 0/5] launch: direct: Disable qemu locking when opening drives readonly (RHBZ#1417306)
- [PATCH] lib: direct: Query qemu binary for availability of KVM (RHBZ#1605071).
- [PATCH 0/4] lib: qemu: Add test for mandatory locking.