From nobody Tue May 7 10:43:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537257608969244.3369584350586; Tue, 18 Sep 2018 01:00:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD7E483F51; Tue, 18 Sep 2018 08:00:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3491D30912F4; Tue, 18 Sep 2018 08:00:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 602E74BB7F; Tue, 18 Sep 2018 08:00:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8I801oq014892 for ; Tue, 18 Sep 2018 04:00:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8ECD873F12; Tue, 18 Sep 2018 08:00:01 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C4C473F0B for ; Tue, 18 Sep 2018 07:59:59 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 76C851004AD; Tue, 18 Sep 2018 09:59:57 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 09:59:56 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Fix error reporting in qemuDomainSaveImageStartVM X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 18 Sep 2018 08:00:07 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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=3Doff: 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 9424994aa1..25cbccc5e6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6590,11 +6590,15 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, restored =3D true; =20 if (intermediatefd !=3D -1) { + virErrorPtr orig_err =3D 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 =3D virSaveLastError(); VIR_FORCE_CLOSE(intermediatefd); VIR_FORCE_CLOSE(*fd); } @@ -6604,6 +6608,11 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, restored =3D false; } VIR_DEBUG("Decompression binary stderr: %s", NULLSTR(errbuf)); + + if (orig_err) { + virSetError(orig_err); + virFreeError(orig_err); + } } VIR_FORCE_CLOSE(intermediatefd); =20 --=20 2.19.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list