From 1468536d423962241f5c30403b27a8c1d9a97b14 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Tue, 18 Sep 2018 09:42:06 +0200 Subject: [PATCH] qemu: Fix error reporting in qemuDomainSaveImageStartVM When restoring a domain from a compressed image, we launch an intermediate process for decompressing the saved data. If QEMU fails to load the data for some reason, we force close the stdin/stdout file descriptors of the intermediate process and wait for it to die. However, virCommandWait can report various errors which would overwrite the real error from QEMU. Thus instead of getting something useful: internal error: process exited while connecting to monitor: 2018-09-17T15:17:29.998910Z qemu-system-x86_64: can't apply global Skylake-Client-x86_64-cpu.osxsave=off: Property '.osxsave' not found we could get an irrelevant error message: internal error: Child process (lzop -dc --ignore-warn) unexpected fatal signal 13 Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_driver.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 809c13410c..d3d25c4acf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6598,11 +6598,15 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, restored = true; if (intermediatefd != -1) { + virErrorPtr orig_err = NULL; + if (!restored) { /* if there was an error setting up qemu, the intermediate * process will wait forever to write to stdout, so we - * must manually kill it. + * must manually kill it and ignore any error related to + * the process */ + orig_err = virSaveLastError(); VIR_FORCE_CLOSE(intermediatefd); VIR_FORCE_CLOSE(*fd); } @@ -6612,6 +6616,11 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, restored = false; } VIR_DEBUG("Decompression binary stderr: %s", NULLSTR(errbuf)); + + if (orig_err) { + virSetError(orig_err); + virFreeError(orig_err); + } } VIR_FORCE_CLOSE(intermediatefd); -- 2.39.5