From nobody Fri May 3 10:30:34 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 151508210432055.339487993743546; Thu, 4 Jan 2018 08:08:24 -0800 (PST) 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 7207F64134; Thu, 4 Jan 2018 16:08:22 +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 DCE765E1BB; Thu, 4 Jan 2018 16:08:21 +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 512C23FAE2; Thu, 4 Jan 2018 16:08:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w04G5Ph0009613 for ; Thu, 4 Jan 2018 11:05:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0254E63132; Thu, 4 Jan 2018 16:05:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E47FE79819; Thu, 4 Jan 2018 16:05:15 +0000 (UTC) Received: from huawei.com (unknown [45.249.212.32]) (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 C3A378B111; Thu, 4 Jan 2018 16:05:12 +0000 (UTC) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B06A46BD4C5AD; Fri, 5 Jan 2018 00:04:55 +0800 (CST) Received: from localhost.localdomain (10.175.124.183) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Fri, 5 Jan 2018 00:04:37 +0800 From: Jie Wang To: , , Date: Fri, 5 Jan 2018 00:12:37 +0800 Message-ID: <1515082357-125733-1-git-send-email-wangjie88@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.183] X-CFilter-Loop: Reflected X-Greylist: Delayed for 61:09:07 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 04 Jan 2018 16:05:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 04 Jan 2018 16:05:13 +0000 (UTC) for IP:'45.249.212.32' DOMAIN:'[45.249.212.32]' HELO:'huawei.com' FROM:'wangjie88@huawei.com' RCPT:'' X-RedHat-Spam-Score: 1.272 * (RDNS_NONE, SPF_HELO_PASS, SPF_PASS) 45.249.212.32 [45.249.212.32] 45.249.212.32 [45.249.212.32] X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: eric.fangyi@huawei.com, wu.wubin@huawei.com, wangjie88@huawei.com Subject: [libvirt] [PATCH V2] blockjob: Fix error checking of blockjob status 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.39]); Thu, 04 Jan 2018 16:08:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" offset and len can also be equal to 0 on failed if blockjob return status:"BLOCK_JOB_COMPLETED" with error:"File descriptor in bad state", so it's better to make our decision based on whether 'error' is non-NULL. --- src/qemu/qemu_monitor_json.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e45868b..ae64a5a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -885,8 +885,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon, switch ((virConnectDomainEventBlockJobStatus) event) { case VIR_DOMAIN_BLOCK_JOB_COMPLETED: error =3D virJSONValueObjectGetString(data, "error"); - /* Make sure the whole device has been processed */ - if (offset !=3D len) + if (error !=3D NULL) event =3D VIR_DOMAIN_BLOCK_JOB_FAILED; break; case VIR_DOMAIN_BLOCK_JOB_CANCELED: --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list