From nobody Fri May 17 11:58:58 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532348599788105.97626945364607; Mon, 23 Jul 2018 05:23:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 95906C04B2C5; Mon, 23 Jul 2018 12:23:17 +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 E97EF5C582; Mon, 23 Jul 2018 12:23:16 +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 74B1D3F8F1; Mon, 23 Jul 2018 12:23:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6NCNDKw019757 for ; Mon, 23 Jul 2018 08:23:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9EAFE308BDB5; Mon, 23 Jul 2018 12:23:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE199308BDAA; Mon, 23 Jul 2018 12:23:09 +0000 (UTC) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EA0833082A42; Mon, 23 Jul 2018 12:23:04 +0000 (UTC) Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id DC66A5F9A98D8; Mon, 23 Jul 2018 20:22:58 +0800 (CST) Received: from localhost (10.177.25.200) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.382.0; Mon, 23 Jul 2018 20:22:50 +0800 From: "xinhua.Cao" To: , , , Date: Mon, 23 Jul 2018 20:22:41 +0800 Message-ID: <20180723122241.11204-1-caoxinhua@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.25.200] X-CFilter-Loop: Reflected X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 23 Jul 2018 12:23:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 23 Jul 2018 12:23:05 +0000 (UTC) for IP:'45.249.212.35' DOMAIN:'szxga07-in.huawei.com' HELO:'huawei.com' FROM:'caoxinhua@huawei.com' RCPT:'' X-RedHat-Spam-Score: -0.002 (SPF_HELO_PASS, SPF_PASS) 45.249.212.35 szxga07-in.huawei.com 45.249.212.35 szxga07-in.huawei.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Cc: liuyongan@huawei.com, "xinhua.Cao" , weidong.huang@huawei.com, king.wang@huawei.com, weifuqiang@huawei.com Subject: [libvirt] [PATCH v2] libvirt_iohelper: record the libvirt_iohelper's error message at virFileWrapperFdFree 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 23 Jul 2018 12:23:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Currently iohelper's error log is recorded in virFileWrapperFdClose. In qemuDomainSaveMemory, it usually fails at qemuMigrationSrcToFile, and then goto cleanup, so the iohelper error log is not recorded, and so is the another placement. We now record the error log of iohelper by move it to the virFileWrapperFdFree record. And for the virCommandWait() - we should call virCommandAbort() in virFileWrapperFdFree() to make sure no process is left behind. If virCommandWait() is called then virCommandAbort() is a NO-OP. If it isn't, then Abort() will kill iohelper. Thanks for Michal for this advice Signed-off-by: xinhua.Cao --- src/util/virfile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 1faeebb..590fc0e 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -330,9 +330,6 @@ virFileWrapperFdClose(virFileWrapperFdPtr wfd) return 0; =20 ret =3D virCommandWait(wfd->cmd, NULL); - if (wfd->err_msg && *wfd->err_msg) - VIR_WARN("iohelper reports: %s", wfd->err_msg); - return ret; } =20 @@ -351,6 +348,10 @@ virFileWrapperFdFree(virFileWrapperFdPtr wfd) if (!wfd) return; =20 + if (wfd->err_msg && *wfd->err_msg) + VIR_WARN("iohelper reports: %s", wfd->err_msg); + + virCommandAbort(wfd->cmd); VIR_FREE(wfd->err_msg); =20 virCommandFree(wfd->cmd); --=20 2.8.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list