From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092055; cv=none; d=zoho.com; s=zohoarc; b=gwXXX+cykt+Y7udOzXQU5gVFeF0HJXp+eVXemORJsIKFe10nVlZZCRHd98/LqIi/G3cGY1anXm1lwbDR8/34K4ZZpRJyxR+9cfex+lE8R4ZcdYU13xCDzMIh3y04UFwK82y5UUvKx7mi3oaGRW9kxz9WldZNAqL2eqPYmuw/1w4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092055; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=dlmpgGco+uO4KnFfegpzpBbXi8dkM2aLzOS4HcWhmpE=; b=DtEHiwUKvgmzp8v7W9ITaYg01+tLwCHo1Q4ZXB6jM18xxwbzYoRITKNzMv0L4OVmw+XhdSjD+n0kurJKdn/WLVCN/qpXIMCHo6iDKfppEJB+tgIbB1xCvNl59MpBNU896bxWDjl7xnxu5ctFOdCTIevLjhilxA7Il4ZKEd3a/0Q= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558092055285496.8171912813382; Fri, 17 May 2019 04:20:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A1928307D84F; Fri, 17 May 2019 11:20:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37241101E665; Fri, 17 May 2019 11:20:12 +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 53B871806B11; Fri, 17 May 2019 11:20:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBK4cG000890 for ; Fri, 17 May 2019 07:20:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 70B3538E0B; Fri, 17 May 2019 11:20:04 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC579348CE for ; Fri, 17 May 2019 11:20:01 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:47 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/12] qemu: blockjob: Remove 'started' from struct _qemuBlockJobData 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 17 May 2019 11:20:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This field is no longer used. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_blockjob.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index c7325c6daf..31d8151ef5 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -71,7 +71,6 @@ struct _qemuBlockJobData { virDomainDiskDefPtr disk; /* may be NULL, if blockjob does not corresp= ond to any disk */ - bool started; int type; /* qemuBlockJobType */ int state; /* qemuBlockjobState */ char *errmsg; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092045; cv=none; d=zoho.com; s=zohoarc; b=kv/Gohq3S+/QW/pho/YbLWsbg5+fmlEk6++vsJQtTPcilPU1Fzt7pKpeU7P7VkK5eCejm01h7fke2BVAJAoHqV8tObY6eMVlLS0idRsT5R5ZWzBq9KEEDIHNDT7Pcx1hY6xGNuQSC/Gd1pGhGBiCp372+UEaYC5y0lLHlYCCGAo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092045; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=28ri5mn13ZwCR78WF+10ZxdrqYIkRS/u30dUvg7xRjk=; b=TqkdVt6GMG8/1VAh6s/ro8os8BdGsl7f7vun1UJLm7JMqicNGZKjsMCwccDI4OgEUMXjqSjsD7HNFrtZe3qIlcIurvfrqgDaSMAithfUHsTjk7CiHv+dS4Hy8cwZLrjkPOFVMvlhiVyPD9BxrJOAzgVxw2kWP0zdxPpkiB3aF04= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558092045677486.05354877067543; Fri, 17 May 2019 04:20:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A6FCC06C9E5; Fri, 17 May 2019 11:20:21 +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 1C6261001DCE; Fri, 17 May 2019 11:20:11 +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 31DBF24AFA; Fri, 17 May 2019 11:20:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBK7fo000910 for ; Fri, 17 May 2019 07:20:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 19BC638E05; Fri, 17 May 2019 11:20:07 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95A5038E03 for ; Fri, 17 May 2019 11:20:04 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:48 +0200 Message-Id: <146db1abfdfb464fb8e2066a7ec6cb1289bba46e.1558091835.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/12] qemu: blockjob: Fix documentation for 'newstate' of _qemuBlockJobData 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 17 May 2019 11:20:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When used with the new job handler the values will also include some of the non-public values from qemuBlockjobState. Modify the comment to clarify this. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_blockjob.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 31d8151ef5..772cc5cba1 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -76,7 +76,7 @@ struct _qemuBlockJobData { char *errmsg; bool synchronous; /* API call is waiting for this job */ - int newstate; /* virConnectDomainEventBlockJobStatus - new state to be= processed */ + int newstate; /* qemuBlockjobState, subset of events emitted by qemu */ }; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092078; cv=none; d=zoho.com; s=zohoarc; b=Pxt3XvSGPwrVe1A9p9yAnGLOKnWUmXf9gl1rqUjo+S4yYUssLKbfb3psLRoGKWmCtWRDSf5x6Dn8KFyiAsYNyfXN3Ak0m/9rwhu5UXdllwfDhTjCrp8CDW9qnYU+wy3ZH09in5XVEyIyOA9tou6vz0YJNoYomFNuMBtgUl5D+iA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092078; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=z6pUioRCMp2iS9LOBKXMU7aa/zQMqhorNdXmL6cahCs=; b=N+HQRM5xU8cMcviMsXWSIyn94deZtwSt+SZFryjdcZhPsYbDgrD/ORPWpaTtwuyVcUCrkSnVBJ5XpE4aRoEDd92C4KDdVQlzEtmvlvBQ0d+pQlo6tU+oBPLLIUqhRYfgrBiWIqyKhb35V0xhrCwupRRBoDMdJRsHaYCnqAOYRG0= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558092078869150.14960639353217; Fri, 17 May 2019 04:21:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 586663B718; Fri, 17 May 2019 11:21:05 +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 1E3DF104C460; Fri, 17 May 2019 11:21:05 +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 D221E206D6; Fri, 17 May 2019 11:21:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBK7sB000916 for ; Fri, 17 May 2019 07:20:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id DF9DC38E05; Fri, 17 May 2019 11:20:07 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 671BF38E03 for ; Fri, 17 May 2019 11:20:07 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:49 +0200 Message-Id: <084ac20c011932bb305caa424ffcd12fd13b2e95.1558091835.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/12] qemu: driver: Don't try to update blockjob status in qemuDomainGetBlockJobInfo 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 17 May 2019 11:21:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" All blockjobs get their status updated by events from qemu, so this code no longer makes sense. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0a425b82e5..33ccb4dfba 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17442,20 +17442,6 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, goto endjob; } - /* Snoop block copy operations, so future cancel operations can - * avoid checking if pivot is safe. Save the change to XML, but - * we can ignore failure because it is only an optimization. We - * hold the vm lock, so modifying the in-memory representation is - * safe, even if we are a query rather than a modify job. */ - if (disk->mirror && - rawInfo.ready !=3D 0 && - info->cur =3D=3D info->end && !disk->mirrorState) { - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); - - disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_READY; - ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm= , driver->caps)); - virObjectUnref(cfg); - } endjob: qemuDomainObjEndJob(driver, vm); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092079; cv=none; d=zoho.com; s=zohoarc; b=YeqQHe2RrFfFp3vOCIp58Vs6cAm8TAntTXwaalxGEd3NNzLhWnU+7uMj8aJFByRieoRnkud4o4l5vBufFYLAlifmbeX4rZcsTHIqtHieQbKaJdvjSan1zk/mMOPngDJ/hK423SPSgv9WOrMmpXwI7HytMsJq+AiFjl6BYZZ5f+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092079; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ATBVBduCpQCBOtkCqHpSzTKVnjhl9e5wfbFJEjaBNRQ=; b=TkgrTVgZi0qifWe4a8KZnzzh2q4GJcol6Xsue6UUx/F82lb/bu7kOYEbk+Py6WSPD+V2NSCESEwfTTt1QhNGvm4gSC23NAV3QMRBfb/WRo1fvGwnG5iwOMTc1lOFiyefSEuDqq3kF7XSaygGjrHl4abIBZDNXRSQfVC1JCLkdpc= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558092079487857.1699542305254; Fri, 17 May 2019 04:21:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B558776CD; Fri, 17 May 2019 11:21: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 29BC5101E69F; Fri, 17 May 2019 11:21: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 D57EB206D7; Fri, 17 May 2019 11:21:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBK8kV000926 for ; Fri, 17 May 2019 07:20:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id B04BD38E05; Fri, 17 May 2019 11:20:08 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 398A038E03 for ; Fri, 17 May 2019 11:20:08 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:50 +0200 Message-Id: <7ad95b3a44c038dc66da9442b728d374c543db7e.1558091835.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/12] qemu: driver: Set mirror state after successful command 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 17 May 2019 11:21:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When aborting or pivoting a block job we record which operation we do for the mirror in the virDomainDiskDef structure. As everything is synchronized by a job it's not necessary to modify the state prior to calling the monitor and reseting the state on failure. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 33ccb4dfba..a7dd4c882f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17107,7 +17107,6 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, * XXX If the abort command is synchronous but the qemu event says * that pivot failed, we need to reflect that failure into the * overall return value. */ - disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT; qemuDomainObjEnterMonitor(driver, vm); ret =3D qemuMonitorDrivePivot(priv->mon, job->name); if (qemuDomainObjExitMonitor(driver, vm) < 0) { @@ -17115,11 +17114,11 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, goto cleanup; } - if (ret < 0) { - /* The pivot failed. The block job in QEMU remains in the synchron= ised - * phase. Reset the state we changed and return the error to the u= ser */ - disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_READY; - } + /* The pivot failed. The block job in QEMU remains in the synchronised= state */ + if (ret < 0) + goto cleanup; + + disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT; cleanup: return ret; @@ -17298,9 +17297,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom, if ((ret =3D qemuDomainBlockPivot(driver, vm, job, disk)) < 0) goto endjob; } else { - if (disk->mirror) - disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_ABORT; - qemuDomainObjEnterMonitor(driver, vm); ret =3D qemuMonitorBlockJobCancel(qemuDomainGetMonitor(vm), job->n= ame); if (qemuDomainObjExitMonitor(driver, vm) < 0) { @@ -17308,11 +17304,11 @@ qemuDomainBlockJobAbort(virDomainPtr dom, goto endjob; } - if (ret < 0) { - if (disk->mirror) - disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_NONE; + if (ret < 0) goto endjob; - } + + if (disk->mirror) + disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_ABORT; } ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, dr= iver->caps)); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092090; cv=none; d=zoho.com; s=zohoarc; b=lvyqTMxY4dKt6qMMZNmPLJ5b6S9tY8rTS03zDWJtOIxOALIDvTZSGPQMQxGxo03fhNlzfj5H7B/Isz0b+Tl1r1v35Ai3iJH56KRcK8NeoL5xY6uaO6ig7gsc4jQ6B4cBGbSuyUldlHcR1oDDXg1drqGfC7ip5naUxIxt5Ypbvbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092090; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=n0YyaIL7fbCfj5071X8xMh30OFN5IXZ2SJl9gA8Lkr8=; b=ESiE+pO4WBA+WmJXDKEf+v2R5+h3QZGPZwnMICnVLlRST5H9YezrHTXZqyh1fHhaeYD3+vfQHh7nTQcuM7AlLZK0PdLS61M8C3VkOlrZ4DW2OdIFGaXTVFRb/4eRVD+Hqpap/6lHnEXeySyvd08FthTtNNoUamJGPEjktq1BqSA= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558092090631394.43288641670176; Fri, 17 May 2019 04:21:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C796C075BCC; Fri, 17 May 2019 11:21:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4FA551853C; Fri, 17 May 2019 11:21:27 +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 16BDA1806B15; Fri, 17 May 2019 11:21:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBK97D000931 for ; Fri, 17 May 2019 07:20:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83C5738E07; Fri, 17 May 2019 11:20:09 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09F0D38E03 for ; Fri, 17 May 2019 11:20:08 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:51 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/12] qemu: Modernize memory cleaning in qemuDomainBlockCopyCommon 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 May 2019 11:21:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use VIR_AUTOFREE, VIR_AUTOUNREF, and VIR_STEAL_PTR. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7dd4c882f..c5ff61124b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17572,7 +17572,7 @@ static int qemuDomainBlockCopyCommon(virDomainObjPtr vm, virConnectPtr conn, const char *path, - virStorageSourcePtr mirror, + virStorageSourcePtr mirrorsrc, unsigned long long bandwidth, unsigned int granularity, unsigned long long buf_size, @@ -17581,15 +17581,16 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, { virQEMUDriverPtr driver =3D conn->privateData; qemuDomainObjPrivatePtr priv; - char *device =3D NULL; + VIR_AUTOFREE(char *) device =3D NULL; virDomainDiskDefPtr disk =3D NULL; int ret =3D -1; bool need_unlink =3D false; - virQEMUDriverConfigPtr cfg =3D NULL; + VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg =3D virQEMUDriverGetConfig(d= river); const char *format =3D NULL; virErrorPtr monitor_error =3D NULL; bool reuse =3D !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); qemuBlockJobDataPtr job =3D NULL; + VIR_AUTOUNREF(virStorageSourcePtr) mirror =3D mirrorsrc; /* Preliminaries: find the disk we are editing, sanity checks */ virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW | @@ -17597,12 +17598,11 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1); priv =3D vm->privateData; - cfg =3D virQEMUDriverGetConfig(driver); if (virStorageSourceIsRelative(mirror)) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("absolute path must be used as block copy target"= )); - goto cleanup; + return -1; } if (bandwidth > LLONG_MAX) { @@ -17610,11 +17610,11 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, _("bandwidth must be less than " "'%llu' bytes/s (%llu MiB/s)"), LLONG_MAX, LLONG_MAX >> 20); - goto cleanup; + return -1; } if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) - goto cleanup; + return -1; if (virDomainObjCheckActive(vm) < 0) goto endjob; @@ -17760,8 +17760,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, qemuBlockJobStarted(job); need_unlink =3D false; virStorageFileDeinit(mirror); - disk->mirror =3D mirror; - mirror =3D NULL; + VIR_STEAL_PTR(disk->mirror, mirror); disk->mirrorJob =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COPY; if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->cap= s) < 0) @@ -17779,10 +17778,6 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, } qemuBlockJobStartupFinalize(job); - cleanup: - VIR_FREE(device); - virObjectUnref(cfg); - virObjectUnref(mirror); return ret; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092088; cv=none; d=zoho.com; s=zohoarc; b=cJmI6wKMey5q0FTiNSf2p61Fq1DHeGBBEhjMw8pR2yl50wcSsyKjLckXtpyF3tQqLz+Yb1ifBs9l8SVCZ1303/xO+VycS7DVlKhwr05DDW8/btNV9fRUMv1cr6IfLCYfdwFN+eZuaNdeOszVyFvuXKkhsEhaGT3clAZpgMOc+3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092088; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=8eaSN6muQFVHg7UqZ50WwvY44Tojm/IE8wyX+MYPiw8=; b=a6oORZ9UszcM4rSiE01iaDi1CiERqectwySjcaPASOX6NW/Tb315Auy0ajjLNmttMej8+X6NWEYinDlPXqzu7P42XWlawsG63RZRfrR/oEz9m5T0JYaTi89eTdy2aezuKt2MErBnEfjcDP9/AWSZ1PImAJTenAkWNmZgAmMkwC8= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155809208871410.25412451170348; Fri, 17 May 2019 04:21:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3072030ADC91; Fri, 17 May 2019 11:21:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0635A614D8; Fri, 17 May 2019 11:21:22 +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 B6D881806B13; Fri, 17 May 2019 11:21:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBKBVO000946 for ; Fri, 17 May 2019 07:20:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6741638E03; Fri, 17 May 2019 11:20:11 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id E590B38E12 for ; Fri, 17 May 2019 11:20:09 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:52 +0200 Message-Id: <3bac25fda1f7bc416f411d63ab2ed2c11ecbcdd2.1558091835.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/12] qemu: Modernize memory cleaning in qemuDomainBlockPullCommon 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 17 May 2019 11:21:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use VIR_AUTOFREE and VIR_AUTOUNREF. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c5ff61124b..c51b0494a0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17136,13 +17136,13 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver, unsigned int flags) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); - char *device =3D NULL; + VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg =3D virQEMUDriverGetConfig(d= river); + VIR_AUTOFREE(char *) device =3D NULL; virDomainDiskDefPtr disk; virStorageSourcePtr baseSource =3D NULL; unsigned int baseIndex =3D 0; - char *basePath =3D NULL; - char *backingPath =3D NULL; + VIR_AUTOFREE(char *) basePath =3D NULL; + VIR_AUTOFREE(char *) backingPath =3D NULL; unsigned long long speed =3D bandwidth; qemuBlockJobDataPtr job =3D NULL; int ret =3D -1; @@ -17235,10 +17235,6 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver, cleanup: qemuBlockJobStartupFinalize(job); - virObjectUnref(cfg); - VIR_FREE(basePath); - VIR_FREE(backingPath); - VIR_FREE(device); virDomainObjEndAPI(&vm); return ret; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092100; cv=none; d=zoho.com; s=zohoarc; b=flyNb1ItPgnqpCRVqC3fnZURLNqvi0E1LNRRoRwoQYGKc/TYflvOlZPHQz80NXtHr4V2J6DF9ri+tfBUQzgEUa50KQbRAB6ahG/sdzLHGdiY4ig/HQWpWxiB6wuRHB0Este2wGdUoC0+XAKwbOziTAgBekXkj6RweKgz657Xu1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092100; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mUSauU83w60+T079JNQcYSku7mCubEZJk65Xveir7pw=; b=WhmegqQcf2qLUhJjI4IjrWEZeRg775EsIydgLJ1KDpIGnAHb7D50D/nsK5Jx/GFEH9OTNwUCJZfP4IjbdGPpn5gv1OlXO3fMcwg9CJnn3HfgEsrqEgcjdneq0GZD9JoP/rMXQIFZIrr7A3R3H0T0CgC4h2VnzqOGOgOEbKlf93g= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155809210033441.59356260799018; Fri, 17 May 2019 04:21:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC063B2DC5; Fri, 17 May 2019 11:21:37 +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 C0D65614DF; Fri, 17 May 2019 11:21:37 +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 7E8A0206D3; Fri, 17 May 2019 11:21:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBKCkg000956 for ; Fri, 17 May 2019 07:20:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 35C6538E03; Fri, 17 May 2019 11:20:12 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B482E348CE for ; Fri, 17 May 2019 11:20:11 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:53 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/12] qemu: Modernize memory cleaning in qemuDomainBlockCommit 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 17 May 2019 11:21:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use VIR_AUTOFREE and VIR_AUTOUNREF. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c51b0494a0..5f9f547118 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17961,10 +17961,10 @@ qemuDomainBlockCommit(virDomainPtr dom, unsigned int flags) { virQEMUDriverPtr driver =3D dom->conn->privateData; - virQEMUDriverConfigPtr cfg =3D NULL; + VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg =3D NULL; qemuDomainObjPrivatePtr priv; virDomainObjPtr vm =3D NULL; - char *device =3D NULL; + VIR_AUTOFREE(char *) device =3D NULL; int ret =3D -1; virDomainDiskDefPtr disk =3D NULL; virStorageSourcePtr topSource; @@ -17973,9 +17973,9 @@ qemuDomainBlockCommit(virDomainPtr dom, unsigned int baseIndex =3D 0; virStorageSourcePtr top_parent =3D NULL; bool clean_access =3D false; - char *topPath =3D NULL; - char *basePath =3D NULL; - char *backingPath =3D NULL; + VIR_AUTOFREE(char *) topPath =3D NULL; + VIR_AUTOFREE(char *) basePath =3D NULL; + VIR_AUTOFREE(char *) backingPath =3D NULL; unsigned long long speed =3D bandwidth; qemuBlockJobDataPtr job =3D NULL; qemuBlockJobType jobtype =3D QEMU_BLOCKJOB_TYPE_COMMIT; @@ -18174,11 +18174,6 @@ qemuDomainBlockCommit(virDomainPtr dom, qemuDomainObjEndJob(driver, vm); cleanup: - VIR_FREE(topPath); - VIR_FREE(basePath); - VIR_FREE(backingPath); - VIR_FREE(device); - virObjectUnref(cfg); virDomainObjEndAPI(&vm); return ret; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092112; cv=none; d=zoho.com; s=zohoarc; b=hWBbnuOKU12h4aZgHidwhpAoiSgHPjZigqtFaNuyIkHklExsvS8wPfjjCPzl5pqKd/sQ4KboSH/dX60GbCiIKRBa9Nr4IrS14Xle+ke8L5Dtmgy2dKeLl5f8bzo/wOIE66FwZnmUq1PcC4aYqAx6Xex1t/ICwnRNyLKmDGGR/Vc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092112; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SMs4q7Ob7VgDGZpSFZ0wzb2vJnATXnJWq85v1NSN4/I=; b=KFTTZ9mkCHhDkHpegO1pXMet102c/o2rN2Fhl7949C6A4tVrVf26f8jQi7KafYaZY2dCCBeEPWNZr5KL99yJQR9kpyWtHe6yZuixf+nQfDdZJCODvOetICPNdUHMDXYlL8qtW+nOWanXyio2tW/93SdEQ5tAX7Q6/WRM4e7HAkE= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558092112194879.2549805871954; Fri, 17 May 2019 04:21:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3DD9DD7818; Fri, 17 May 2019 11:21:50 +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 1684D5D973; Fri, 17 May 2019 11:21:50 +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 C8B18206D5; Fri, 17 May 2019 11:21:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBKDGR000964 for ; Fri, 17 May 2019 07:20:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 06AD638E0B; Fri, 17 May 2019 11:20:13 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84AB5348CE for ; Fri, 17 May 2019 11:20:12 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:54 +0200 Message-Id: <1f0df0e8933c2cd07276d70155882e6fc8f6e8ec.1558091835.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/12] qemu: Remove unecessary error keeping in qemuDomainBlockCopyCommon 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 17 May 2019 11:21:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Since 3decae00e90 qemuDomainStorageSourceAccessRevoke keeps the libvirt error which was set prior to the call around even after the call, thus we don't need to do the same when reverting access in the block copy code. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5f9f547118..d7b849f953 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17583,7 +17583,6 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, bool need_unlink =3D false; VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg =3D virQEMUDriverGetConfig(d= river); const char *format =3D NULL; - virErrorPtr monitor_error =3D NULL; bool reuse =3D !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); qemuBlockJobDataPtr job =3D NULL; VIR_AUTOUNREF(virStorageSourcePtr) mirror =3D mirrorsrc; @@ -17747,7 +17746,6 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, if (qemuDomainObjExitMonitor(driver, vm) < 0) ret =3D -1; if (ret < 0) { - monitor_error =3D virSaveLastError(); qemuDomainStorageSourceAccessRevoke(driver, vm, mirror); goto endjob; } @@ -17768,10 +17766,6 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, VIR_WARN("%s", _("unable to remove just-created copy target")); virStorageFileDeinit(mirror); qemuDomainObjEndJob(driver, vm); - if (monitor_error) { - virSetError(monitor_error); - virFreeError(monitor_error); - } qemuBlockJobStartupFinalize(job); return ret; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092109; cv=none; d=zoho.com; s=zohoarc; b=kJqS1uu00WPNXgT1J7QFqmA/3KY8qFrX2Ma9OEqHcWejmR8ToRlC8bbtCyZg3veWydf5q1ss86Q2AccFHWXl6GLBHuXNI95+7uzr5I3AMKFFopCygU/UXu3jAek4pozczntg6FQ0Kwq2zcZ+kQveO+GlLInm/Jw90TW54BiHC6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092109; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=uqVunZ0HPm0W7nrZ6z0ZA+WQaXkUr56iLdprSoPqD2k=; b=YKx+JxlA/AtgSJwC11TimFiv9g9n+sd4WNDkDNf9FxlqRZPjjfX9PV+V1QkJaNPA/WV85sVaCx/ggDF/DoVR2eWgyiAM+AVuIa+rmAm/+ITmgHwtU4MPR2tSJLM9I6qcOZNPchJWgF3c9ci1ldzBV4AXlyL77cnzhJfll9t0YGA= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558092109083820.417288496349; Fri, 17 May 2019 04:21:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41A3C30C2516; Fri, 17 May 2019 11:21:47 +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 16F6260A9A; Fri, 17 May 2019 11:21:47 +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 CFE93206D4; Fri, 17 May 2019 11:21:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBKHTZ000982 for ; Fri, 17 May 2019 07:20:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 209E95633F; Fri, 17 May 2019 11:20:17 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E9A94EE0E for ; Fri, 17 May 2019 11:20:13 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:55 +0200 Message-Id: <98f066ba00c2f704a89e91eafd3e80c2828b305b.1558091835.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/12] qemu: Remove unnecessary calls to qemuDomainStorageSourceAccessRevoke 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 17 May 2019 11:21:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Since 3decae00e90 qemuDomainStorageSourceAccessAllow revokes the permissions it granted if it fails halfway, thus we can remove some calls to qemuDomainStorageSourceAccessRevoke which tried to undo this situation. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d7b849f953..66a6eb0483 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15213,10 +15213,8 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDr= iverPtr driver, } /* set correct security, cgroup and locking options on the new image */ - if (qemuDomainStorageSourceAccessAllow(driver, vm, dd->src, false, tru= e) < 0) { - qemuDomainStorageSourceAccessRevoke(driver, vm, dd->src); + if (qemuDomainStorageSourceAccessAllow(driver, vm, dd->src, false, tru= e) < 0) goto cleanup; - } dd->prepared =3D true; @@ -17725,10 +17723,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, qemuSecuritySetImageLabel(driver, vm, mirror, true) < 0) goto endjob; } else { - if (qemuDomainStorageSourceAccessAllow(driver, vm, mirror, false, = true) < 0) { - qemuDomainStorageSourceAccessRevoke(driver, vm, mirror); + if (qemuDomainStorageSourceAccessAllow(driver, vm, mirror, false, = true) < 0) goto endjob; - } } if (!(job =3D qemuBlockJobDiskNew(disk, QEMU_BLOCKJOB_TYPE_COPY, devic= e))) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092088; cv=none; d=zoho.com; s=zohoarc; b=L4qFLRlRScKOUMDeqqtsgOmTNI6MhogC8CLn2pmIq3YITRsvOdHXlbG9BOd3wOckCDKkLba/Ei5fVL0lFfNTMCioUkpn7VjfQ+Q++Krc0uxOVfaUdOV18uDE5A1+zcTehdD1bnz63KQUc/bjHFCNmQ5O5bI+UYxjw3VWfvl//qM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092088; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=eO9vpeKwhELwxS1THgRY22o0cOaFcOGsaGQU7BaB624=; b=Kpht0CPj9qAGI+UxER7qLeCxUup8vjkwYrRugTr4VIaRMM29UmB9VJf2WSX3zLuWzRJ+2OI7n0IuHcmW/VMjK6rqkjEv6+fLn4E6t7WaAQvccICBaS/Z12G38LGqmDLqv3tc2TO4F9aEivbSzqLZmNFfL0tBsvq0E/xObvYiFy4= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155809208872047.24666035130235; Fri, 17 May 2019 04:21:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F22F09D406; Fri, 17 May 2019 11:21:23 +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 C23CB78381; Fri, 17 May 2019 11:21:23 +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 83DCA206D6; Fri, 17 May 2019 11:21:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBKShE000994 for ; Fri, 17 May 2019 07:20:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9FF28473BE; Fri, 17 May 2019 11:20:28 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 296D158C87 for ; Fri, 17 May 2019 11:20:17 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:56 +0200 Message-Id: <1728dc9aebf218633bb50b8d64927b23ace885d9.1558091835.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/12] qemu: Validate backing store of 'mirror' for block copy 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 17 May 2019 11:21:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Since 4e797f1a we parse backingStore of mirror which will later be used with blockdev. Add some validation for the user passed mirror at the current point to make sure it's not used improperly. Validate that it's not used without blockdev and also that it's not passed when not requesting a shallow copy. Also add a chain terminator for a deep copy since we know the resulting mirror will not have chain. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 72 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 66a6eb0483..a9c41d1592 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17560,6 +17560,63 @@ qemuDomainBlockCopyValidateMirror(virStorageSource= Ptr mirror, } +/** + * qemuDomainBlockCopyCommonValidateUserMirrorBackingStore: + * @mirror: target of the block copy + * @flags: block copy API flags + * @blockdev: true if blockdev is used for the VM + * + * Validates whether backingStore of @mirror makes sense according to @fla= gs. + * This makes sure that: + * 1) mirror has a terminator if it isn't supposed to have backing chain + * 2) if shallow copy is requested there is a chain or prepopulated image + * 3) user specified chain is present only when blockdev is used + * 4) if deep copy is requested, there's no chain + */ +static int +qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(virStorageSourcePt= r mirror, + unsigned int flags, + bool blockdev) +{ + /* note that if original disk does not have backing chain, shallow is = cleared */ + bool shallow =3D flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW; + bool reuse =3D flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT; + + if (!mirror->backingStore) { + /* deep copy won't need backing store so we can terminate it */ + if (!shallow && + !(mirror->backingStore =3D virStorageSourceNew())) + return -1; + + return 0; + } + + /* validate user provided backing store */ + if (virStorageSourceHasBacking(mirror)) { + if (!blockdev) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("backingStore of mirror target is not support= ed by this qemu")); + return -1; + } + + if (!shallow) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("backingStore of mirror without VIR_DOMAIN_BL= OCK_COPY_SHALLOW doesn't make sense")); + return -1; + } + } else { + /* shallow copy without reuse requires some kind of backing data */ + if (!reuse && shallow) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("VIR_DOMAIN_BLOCK_COPY_SHALLOW implies backin= g chain for mirror")); + return -1; + } + } + + return 0; +} + + /* bandwidth in bytes/s. Caller must lock vm beforehand, and not * access mirror afterwards. */ static int @@ -17574,7 +17631,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, bool keepParentLabel) { virQEMUDriverPtr driver =3D conn->privateData; - qemuDomainObjPrivatePtr priv; + qemuDomainObjPrivatePtr priv =3D vm->privateData; VIR_AUTOFREE(char *) device =3D NULL; virDomainDiskDefPtr disk =3D NULL; int ret =3D -1; @@ -17584,14 +17641,13 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, bool reuse =3D !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); qemuBlockJobDataPtr job =3D NULL; VIR_AUTOUNREF(virStorageSourcePtr) mirror =3D mirrorsrc; + bool blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); /* Preliminaries: find the disk we are editing, sanity checks */ virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW | VIR_DOMAIN_BLOCK_COPY_REUSE_EXT | VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1); - priv =3D vm->privateData; - if (virStorageSourceIsRelative(mirror)) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("absolute path must be used as block copy target"= )); @@ -17640,6 +17696,10 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, if (!virStorageSourceHasBacking(disk->src)) flags &=3D ~VIR_DOMAIN_BLOCK_COPY_SHALLOW; + if (qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(mirror, fl= ags, + blockdev) = < 0) + goto endjob; + /* unless the user provides a pre-created file, shallow copy into a raw * file is not possible */ if ((flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW) && !reuse && @@ -17705,11 +17765,11 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, keepParentLabel) < 0) goto endjob; - /* If reusing an external image that includes a backing file, the pivo= t may - * result in qemu needing to open the entire backing chain, so we need= to - * label the full backing chain of the mirror instead of just the top = image */ + /* If reusing an external image that includes a backing file but the u= ser + * did not enumerate the chain in the XML we need to detect the chain = */ if (flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT && mirror->format >=3D VIR_STORAGE_FILE_BACKING && + mirror->backingStore =3D=3D NULL && qemuDomainDetermineDiskChain(driver, vm, disk, mirror, true) < 0) goto endjob; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092127; cv=none; d=zoho.com; s=zohoarc; b=ZtKKSw2IWR+afHMeJ0wCjKfC2yk1sXJMyE+kUE3MaXqtF2DSrfqwNz690Pz4tr9vU1ZAOn7acPk3y2qHyxmbd2neeUqEbPQndOPt7+sVfvKoEyvggM3Ikho0FknztOO71kMFRHpxiBCtxRwNvqkzg0M3EnHr4G1oC+oOf/7iW20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092127; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=l9sITRZuuYiqmMqh+CtZnYJv6VpabOJuVykh96ZH+RY=; b=UpHVhVxyAfXZ0msTpM8123zQlrYPt6puDHApK7MLTC5dS1LNDccR6zjLFXGRyuo8MkpYoVwpPmUEbypwxX42899rY+EcECN7cX38qyhASZR9zgWw02A5SwtRaGUPEXqfbvU9mkxw9NMnfWAmCtuw8unhP6naac21X16d1uUMpf0= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558092127328134.05034717236595; Fri, 17 May 2019 04:22:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A3FCC072269; Fri, 17 May 2019 11:22:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 466E05D707; Fri, 17 May 2019 11:22:00 +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 00B561806B11; Fri, 17 May 2019 11:21:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBKXpB001004 for ; Fri, 17 May 2019 07:20:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id C1E9B348CE; Fri, 17 May 2019 11:20:33 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49C74473C6 for ; Fri, 17 May 2019 11:20:28 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:57 +0200 Message-Id: <1dfbf052dffba27ba7450c340386870800eb3c5f.1558091835.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/12] qemu: Simplify allowing access to storage file for block copy 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 17 May 2019 11:22:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" One code path open-coded qemuDomainStorageSourceChainAccessAllow badly and also did not integrate with the locking code. Replace the separate calls with qemuDomainStorageSourceChainAccessAllow which does everything internally. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a9c41d1592..bd04d21907 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17778,9 +17778,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, /* note that we don't really know whether a part of the backing ch= ain * is shared so rolling this back is not as easy. Thus we do it on= ly * if there's a backing chain */ - if (qemuDomainNamespaceSetupDisk(vm, mirror) < 0 || - qemuSetupImageChainCgroup(vm, mirror) < 0 || - qemuSecuritySetImageLabel(driver, vm, mirror, true) < 0) + if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < = 0) goto endjob; } else { if (qemuDomainStorageSourceAccessAllow(driver, vm, mirror, false, = true) < 0) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 14:22:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1558092122; cv=none; d=zoho.com; s=zohoarc; b=bg1vR4c5HopKcbqc8POT2s/bzqEuLZwZ/olnRmTo4fxJHk4Fn+8JETWLKhkimfqnJE7jwFeAL72BnMrV+d3iM9OiDFNOGzoFGEDuR8udGvKeMWiJUMkd4/Z1QYVpTHtDWB3wIWhoV8xcMHZlh+RR8THeRKMVV/irJH9+42p3+O8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558092122; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KeZUGGYATbDl2y9esiye/NqDj3IxK4nXMaPGrcG3bZI=; b=l8Sab6gKghKwWABdvEMygdhg5zfeMkUd+qN2v9kHJZNaDZ1N4m/cPpdeFULUesIE4rou0riFbU98QaJguZ/weBhJF75WhJKQYOPF10E9sq+N1/Gnk+pAt3Os/J/WzrfEbtunTr2y4F6mVtbASC8KKswIFE+VYfUe+ctLwz/UZj4= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558092122718930.4340696815312; Fri, 17 May 2019 04:22:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E35D130C0DE9; Fri, 17 May 2019 11:21:55 +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 B7442348CE; Fri, 17 May 2019 11:21:55 +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 7B2CA206D3; Fri, 17 May 2019 11:21:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4HBKcHM001015 for ; Fri, 17 May 2019 07:20:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C47138E0B; Fri, 17 May 2019 11:20:38 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B994E57DEE for ; Fri, 17 May 2019 11:20:33 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 17 May 2019 13:19:58 +0200 Message-Id: <8082e6ef352a3228fc29a5a74ede58fdbd5933c8.1558091835.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/12] qemu: blockcopy: sanitize permission handling for 'mirror' 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 17 May 2019 11:21:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" At the point when we want to modify the permissions for the 'mirror' we know whether it is supposed to have a backing chain or no. Given that mirror->backingStore is populated only when we'd need to touch it ayways we can use qemuDomainStorageSourceChainAccessAllow even in place of qemuDomainStorageSourceAccessAllow used for other cases to simplify the code. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index bd04d21907..89ad6e0606 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17773,17 +17773,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, qemuDomainDetermineDiskChain(driver, vm, disk, mirror, true) < 0) goto endjob; - if (flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT && - virStorageSourceHasBacking(mirror)) { - /* note that we don't really know whether a part of the backing ch= ain - * is shared so rolling this back is not as easy. Thus we do it on= ly - * if there's a backing chain */ - if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < = 0) - goto endjob; - } else { - if (qemuDomainStorageSourceAccessAllow(driver, vm, mirror, false, = true) < 0) - goto endjob; - } + if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < 0) + goto endjob; if (!(job =3D qemuBlockJobDiskNew(disk, QEMU_BLOCKJOB_TYPE_COPY, devic= e))) goto endjob; @@ -17800,7 +17791,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, if (qemuDomainObjExitMonitor(driver, vm) < 0) ret =3D -1; if (ret < 0) { - qemuDomainStorageSourceAccessRevoke(driver, vm, mirror); + qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror); goto endjob; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list