From nobody Sun May 5 00:17:21 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=1564002478; cv=none; d=zoho.com; s=zohoarc; b=UCNFxmFZCECj7OXNMCt17RqRxooeWxrHEZam467v577r2gkpiLlA7qAvzZxYz8yPVxGb0c3BFVaEsxezsnobqJS4+HlAVhBLpV+nk548dtqU9X6XP1MBgoRQBexb3VXrGI/oRXrLnigKBq1+aMrQhJTUXkWimzb0hqiOHEcLK+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564002478; 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=Q7XFypMsdBOAdkH5Wo2nhrSxsfheJvjttfmSnk8M+h8=; b=eKNlboAD++vRGDSdJEltvttOW1rZPNbIKwT+Bvx1UsVYA9xhgnozZD/lDpkp2qcnLXtziV69c2doFx3Lq6xJlpIIlYRk+Kb+dLdwfQpqCmP9GNBf0tlLWRlYjgQk9Rib75vtBJpKKGwi/ONGkpXPD4BCcfgZ5cPUNkF/Ce3e6wM= 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 1564002478753460.9202310072917; Wed, 24 Jul 2019 14:07:58 -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 AF0747FDCC; Wed, 24 Jul 2019 21:07:57 +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 85E4519C7F; Wed, 24 Jul 2019 21:07:57 +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 4F0FB1800202; Wed, 24 Jul 2019 21:07:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6OL7eCP003644 for ; Wed, 24 Jul 2019 17:07:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id C185F5DA34; Wed, 24 Jul 2019 21:07:40 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D3065D967 for ; Wed, 24 Jul 2019 21:07:40 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 24 Jul 2019 23:07:28 +0200 Message-Id: <07ec26f436ea458cab08ad844a0d1103795bc4f2.1564002117.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/9] qemu: blockjob: Use proper value when setting disk's READY state 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.27]); Wed, 24 Jul 2019 21:07:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit c412383796c used value from wrong enum when setting the disk's mirrorState variable. This meant that a 'READY' job would show up as 'PIVOTING'. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index da4f20929b..e63dc49e92 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -723,7 +723,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver, case QEMU_BLOCKJOB_STATE_READY: if (job->disk && job->disk->mirror) { - job->disk->mirrorState =3D VIR_DOMAIN_BLOCK_JOB_READY; + job->disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_READY; qemuBlockJobEmitEvents(driver, vm, job->disk, job->type, job->= newstate); } job->state =3D job->newstate; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 00:17:21 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=1564002466; cv=none; d=zoho.com; s=zohoarc; b=jbKfFjGR6uAJdiiMj+Zg/9Ty4BXWF4hjB/sHXq4HuTmISRJ0of4sqbPQd/qxZgJR8Ews8cWHoXAovbe85mDJAuzi2AYOyo+iiuXkyJdVviQYraKjZXmBpmErZ4h+gEWi+IDkV29kxdU+OWJ7ops63FUMGHZ7v689RIJJhs5CW7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564002466; 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=nllnUaO/wk9LPv96rlgjCIV9ZwDEAPSzVS0ndmNrBtg=; b=EwhmnmKsCII9AWBEydGnroLszJ9pXBbZbrdGP1d6StKWWs7CujH4yKyrNPVsdxV50nYUYu5BDhRWPtQYhi1hf2zXkce65p/xWHKa7JNDBKO+9zRVgtAR0du0JsDbqttGYsrPEjLWPAmMqdVy4cJroZa51Keuqo2k3KOipjJHnBU= 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 156400246670548.30166086186762; Wed, 24 Jul 2019 14:07:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8BE9E3082E72; Wed, 24 Jul 2019 21:07:45 +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 C2CB160BEC; Wed, 24 Jul 2019 21:07:44 +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 4FC70264CB; Wed, 24 Jul 2019 21:07:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6OL7fLD003653 for ; Wed, 24 Jul 2019 17:07:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DF4C5D967; Wed, 24 Jul 2019 21:07:41 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18F3B5DA34 for ; Wed, 24 Jul 2019 21:07:40 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 24 Jul 2019 23:07:29 +0200 Message-Id: <53359ff6e855c275704f0aa1baec57bbbc171fac.1564002117.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/9] tests: qemustatusxml: Add few disks with backing chains for blockdev job testing 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 24 Jul 2019 21:07:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add 4 disks to the blockjob-blockdev-in.xml test case to allow adding data for block pull, block copy, block commit, and active block commit jobs. Signed-off-by: Peter Krempa --- .../blockjob-blockdev-in.xml | 264 ++++++++++++++++++ 1 file changed, 264 insertions(+) diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/q= emustatusxml2xmldata/blockjob-blockdev-in.xml index 43fe02137b..5b9777ca71 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -320,6 +320,270 @@
+ + + + + + + + + + + + + + + + + + + pull3.qcow2 + + + + + + + + + + + pull2.qcow2 + + + + + + + + + + + pull1.qcow2 + + + + + + + + + + + pull0.qcow2 + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + commit3.qcow2 + + + + + + + + + + + commit2.qcow2 + + + + + + + + + + + commit1.qcow2 + + + + + + + + + + + commit0.qcow2 + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + copy3.qcow2 + + + + + + + + + + + copy2.qcow2 + + + + + + + + + + + copy1.qcow2 + + + + + + + + + + + copy0.qcow2 + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + activecommit3.qcow2 + + + + + + + + + + + activecommit2.qcow2 + + + + + + + + + + + activecommit1.qcow2 + + + + + + + + + + + activecommit0.qcow2 + + + + + + + + + +
+ + + +
--=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 00:17:21 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=1564002467; cv=none; d=zoho.com; s=zohoarc; b=Ns8mHGkPuaRR2cpruPw2+wQam8wL0amh18e3erbMJvRoUrY6mHTrIwQa3POc7KKXQMKN87/RFt5hTYqJUFhd4FpRHhoDgryVSISi+6wxcH4AIANebTK9+ml8t68p+VWVvGR3eVg7Ob3HACZsmmim7kVg7w+vxz6EO8lMmnyW9eM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564002467; 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=WBXGUXHccvn/NDxCNOvCiiAnei2hXTGrjoQsb3NeNE4=; b=khNrwW+RRMBhdYFk+dEYTzDkD0JHV37zPyq4rbNRD5Q6PgUmqrQN3vB+O0WXG6G+c4n0gdNPv58YygZtjNqmVGttkVGBZ35Ps4bbhJxnSzNcmudoVfQziHla8+nR/YFkuONvg1U+qH05YCdRWW2ewM6XRBDVOJkTYU/4Ti8mpWo= 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 1564002467666161.2208550690758; Wed, 24 Jul 2019 14:07:47 -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 7A6B1300413A; Wed, 24 Jul 2019 21:07:46 +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 4E66660603; Wed, 24 Jul 2019 21:07:46 +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 121C61972D; Wed, 24 Jul 2019 21:07:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6OL7g9T003666 for ; Wed, 24 Jul 2019 17:07:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C3655DA34; Wed, 24 Jul 2019 21:07:42 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBB5B5D967 for ; Wed, 24 Jul 2019 21:07:41 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 24 Jul 2019 23:07:30 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/9] qemu: blockjob: Document qemuBlockJobRegister 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.46]); Wed, 24 Jul 2019 21:07:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index e63dc49e92..ac7b3a0aef 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -117,6 +117,16 @@ qemuBlockJobDataNew(qemuBlockJobType type, } +/** + * qemuBlockJobRegister: + * @job: job to register + * @vm: domain to register @job with + * @disk: disk to register @job with + * @savestatus: save the status XML after registering + * + * This function registers @job with @disk and @vm and records it into the= status + * xml (if @savestatus is true). + */ int qemuBlockJobRegister(qemuBlockJobDataPtr job, virDomainObjPtr vm, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 00:17:21 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=1564002478; cv=none; d=zoho.com; s=zohoarc; b=H32iJMMdWfI08rfNgkVc6sigRRhNR+1JnrnGZRVMPU8sIYcQAudamht3WUFj5eUNo6kbGcjobW1Pk+ahowRgDjiZZROITvo8fqySNNWN1gbBbMlk/R2pnpG5/f4IK41Xdn5vdF3eJrv/faMMfbGZCnYuslIF+qyot34QzVRQ1iI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564002478; 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=lY2nuSQOkPPC/bwhK++gTkbbMwDdH5/TLsOM1tCrt8Q=; b=curqjIK4BeMgPi9bmC7q/+MRpadOrwd9d3V3Cy1eKrmw8aMBl+yA0CU1gbYVd5eRAR/QuUvAR73Zun9aQOYFCu+SVzPAxcmy96W+C5Gj6ujoGn9cYVMDwA6iuh9k1QwS6J9oBF7YO/TpbB9XHyHI6Gt7ZYm7dOyLdUPtfpfDvWo= 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 156400247884866.49705543848108; Wed, 24 Jul 2019 14:07:58 -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 AA9A8307D90D; Wed, 24 Jul 2019 21:07:57 +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 7E31260624; Wed, 24 Jul 2019 21:07:57 +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 47F2A18045CE; Wed, 24 Jul 2019 21:07:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6OL7hxW003677 for ; Wed, 24 Jul 2019 17:07:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 27D8F5D967; Wed, 24 Jul 2019 21:07:43 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id A71E95DA34 for ; Wed, 24 Jul 2019 21:07:42 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 24 Jul 2019 23:07:31 +0200 Message-Id: <6ae8e6f0125c0438ceb6e937fd62e1789612e091.1564002117.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/9] qemu: blockjob: Register disk->mirror with a job only when required 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.48]); Wed, 24 Jul 2019 21:07:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit job for example references existing storage in the subelement thus tracking it separately could lead into problems. This patch introduces qemuBlockJobDiskRegisterMirror which registers the mirror chain separately only for job which require it. This also comes with remembering that in the status XML. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 22 ++++++++++++++++++- src/qemu/qemu_blockjob.h | 4 ++++ src/qemu/qemu_domain.c | 14 +++++++++++- .../blockjob-blockdev-in.xml | 2 +- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index ac7b3a0aef..a3109d3934 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -126,6 +126,9 @@ qemuBlockJobDataNew(qemuBlockJobType type, * * This function registers @job with @disk and @vm and records it into the= status * xml (if @savestatus is true). + * + * Note that if @job also references a separate chain e.g. for disk mirror= ing + * qemuBlockJobDiskRegisterMirror should be used. */ int qemuBlockJobRegister(qemuBlockJobDataPtr job, @@ -143,7 +146,6 @@ qemuBlockJobRegister(qemuBlockJobDataPtr job, if (disk) { job->disk =3D disk; job->chain =3D virObjectRef(disk->src); - job->mirrorChain =3D virObjectRef(disk->mirror); QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob =3D virObjectRef(job); } @@ -205,6 +207,24 @@ qemuBlockJobDiskNew(virDomainObjPtr vm, } +/** + * qemuBlockJobDiskRegisterMirror: + * @job: block job to register 'mirror' chain on + * + * In cases when the disk->mirror attribute references a separate storage = chain + * such as for block-copy, this function registers it with the job. Note + * that this function does not save the status XML and thus must be used b= efore + * qemuBlockJobRegister or qemuBlockJobStarted to properly track the chain + * in the status XML. + */ +void +qemuBlockJobDiskRegisterMirror(qemuBlockJobDataPtr job) +{ + if (job->disk) + job->mirrorChain =3D virObjectRef(job->disk->mirror); +} + + /** * qemuBlockJobDiskGetJob: * @disk: disk definition diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 47bdc54b2b..3299207610 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -110,6 +110,10 @@ qemuBlockJobDiskNew(virDomainObjPtr vm, const char *jobname) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4); +void +qemuBlockJobDiskRegisterMirror(qemuBlockJobDataPtr job) + ATTRIBUTE_NONNULL(1); + qemuBlockJobDataPtr qemuBlockJobDiskGetJob(virDomainDiskDefPtr disk) ATTRIBUTE_NONNULL(1); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e7f28aa2b8..c508f55287 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2367,7 +2367,10 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *= payload, virBufferEscapeString(&childBuf, "%s", job->errmsg); if (job->disk) { - virBufferEscapeString(&childBuf, "\n", job->disk= ->dst); + virBufferEscapeString(&childBuf, "disk->ds= t); + if (job->mirrorChain) + virBufferAddLit(&childBuf, " mirror=3D'yes'"); + virBufferAddLit(&childBuf, "/>\n"); } else { if (job->chain && qemuDomainObjPrivateXMLFormatBlockjobFormatChain(&chainsBuf, @@ -2806,6 +2809,7 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObj= Ptr vm, int state =3D QEMU_BLOCKJOB_STATE_FAILED; VIR_AUTOFREE(char *) diskdst =3D NULL; VIR_AUTOFREE(char *) newstatestr =3D NULL; + VIR_AUTOFREE(char *) mirror =3D NULL; int newstate =3D -1; bool invalidData =3D false; xmlNodePtr tmp; @@ -2840,6 +2844,10 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainOb= jPtr vm, !(disk =3D virDomainDiskByName(vm->def, diskdst, false))) invalidData =3D true; + if ((mirror =3D virXPathString("string(./disk/@mirror)", ctxt)) && + STRNEQ(mirror, "yes")) + invalidData =3D true; + if (!disk && !invalidData) { if ((tmp =3D virXPathNode("./chains/disk", ctxt)) && !(job->chain =3D qemuDomainObjPrivateXMLParseBlockjobChain(tmp= , ctxt, xmlopt))) @@ -2854,6 +2862,10 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainOb= jPtr vm, job->newstate =3D newstate; job->errmsg =3D virXPathString("string(./errmsg)", ctxt); job->invalidData =3D invalidData; + job->disk =3D disk; + + if (mirror) + qemuBlockJobDiskRegisterMirror(job); if (qemuBlockJobRegister(job, vm, disk, false) < 0) return -1; diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/q= emustatusxml2xmldata/blockjob-blockdev-in.xml index 5b9777ca71..7b9282d059 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -235,7 +235,7 @@ - + --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 00:17:21 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=1564002479; cv=none; d=zoho.com; s=zohoarc; b=Oeq4ITs0UGPjdZS/Y0CLAre550fgOW9hLzdZGqN4105+F1aAzSqM0UVPDQVmis66xUtQpFDN+TEOTz3HL9+6MGSkXDcBiqyTdVAkJcs4/L7ifFTrFQgNm3uWRMQif/5VAN93kZcemZGnmEzWJWA0bOeqQH2c49axyPQvhZAIu2w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564002479; 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=9PhpORUehT8U6QdjSQWz5F9nKkn77qluQU5LTqy3TnM=; b=VsdMwNiVnx1coPgXD7Xd62QA12jrPZp9Og+wv62LR3hcKy6fuh/kLC8p0FYMED+pxAcYctvMjrzAr5ZD40MKeoYBT+4nHUe/358JeHbGSg2efAqvOZih0AU+GV6sKD+usk3FFA/RFKXs+19fmXLJGwy+pXVj7/yqDdg02r3NVFY= 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 1564002479539272.2300694855219; Wed, 24 Jul 2019 14:07:59 -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 ACD6C3C937; Wed, 24 Jul 2019 21:07:57 +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 75C6860619; Wed, 24 Jul 2019 21:07:57 +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 3D21E1800207; Wed, 24 Jul 2019 21:07:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6OL7hHj003682 for ; Wed, 24 Jul 2019 17:07:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id E87D75DA34; Wed, 24 Jul 2019 21:07:43 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73C6C5D967 for ; Wed, 24 Jul 2019 21:07:43 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 24 Jul 2019 23:07:32 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/9] qemu: blockjob: Split out update of persistent XML disk's source on mirror jobs 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]); Wed, 24 Jul 2019 21:07:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Both active block commit and block copy modify the disk source of the active definition and thus also must modify the corresponding inactive definition source so that the VM starts up later. This is currently implemented in the legacy block job handler but the logic will be ueful also for the new handlers. Split it out which also simplifies it. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 64 ++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index a3109d3934..f9e79db131 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -434,6 +434,44 @@ qemuBlockJobEmitEvents(virQEMUDriverPtr driver, } +/** + * qemuBlockJobRewriteConfigDiskSource: + * @vm: domain object + * @disk: live definition disk + * @newsrc: new source which should be also considered for the new disk + * + * For block jobs which modify the running disk source it is required that= we + * try our best to update the config XML's disk source as well in most cas= es. + * + * This helper finds the disk from the persistent definition corresponding= to + * @disk and updates it's source to @newsrc. + */ +static void +qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr newsrc) +{ + virDomainDiskDefPtr persistDisk =3D NULL; + VIR_AUTOUNREF(virStorageSourcePtr) copy =3D NULL; + + if (!vm->newDef) + return; + + if (!(persistDisk =3D virDomainDiskByName(vm->newDef, disk->dst, false= ))) + return; + + if (!(copy =3D virStorageSourceCopy(newsrc, false)) || + virStorageSourceInitChainElement(copy, persistDisk->src, true) < 0= ) { + VIR_WARN("Unable to update persistent definition on vm %s after bl= ock job", + vm->def->name); + return; + } + + virObjectUnref(persistDisk->src); + VIR_STEAL_PTR(persistDisk->src, copy); +} + + static void qemuBlockJobEventProcessLegacyCompleted(virQEMUDriverPtr driver, virDomainObjPtr vm, @@ -441,36 +479,12 @@ qemuBlockJobEventProcessLegacyCompleted(virQEMUDriver= Ptr driver, int asyncJob) { virDomainDiskDefPtr disk =3D job->disk; - virDomainDiskDefPtr persistDisk =3D NULL; if (!disk) return; if (disk->mirrorState =3D=3D VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT) { - if (vm->newDef) { - virStorageSourcePtr copy =3D NULL; - - if ((persistDisk =3D virDomainDiskByName(vm->newDef, - disk->dst, false))) { - copy =3D virStorageSourceCopy(disk->mirror, false); - if (!copy || - virStorageSourceInitChainElement(copy, - persistDisk->src, - true) < 0) { - VIR_WARN("Unable to update persistent definition " - "on vm %s after block job", - vm->def->name); - virObjectUnref(copy); - copy =3D NULL; - persistDisk =3D NULL; - } - } - if (copy) { - virObjectUnref(persistDisk->src); - persistDisk->src =3D copy; - } - } - + qemuBlockJobRewriteConfigDiskSource(vm, disk, disk->mirror); /* XXX We want to revoke security labels as well as audit that * revocation, before dropping the original source. But it gets * tricky if both source and mirror share common backing files (we --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 00:17:21 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=1564002481; cv=none; d=zoho.com; s=zohoarc; b=CXIOu17QsJZQiXa64+legYoj/KVkJRa1SRWPr/QU5KO6FsT6GJAonykv7j8+beAghANruy0a4bibckL7VjyHQrL/eXy4c6wD7Z0orFv67Htz/9dPxZGuXu+VsvHahrsOf28AbCEXP0lgrhgKCA+RUI5wPxn286vvKDNiw/3tsuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564002481; 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=3MhmCDhnTQa5eRJCm/Lbb0s8QN6VZUtOgZLDMTTNJrs=; b=TPC6dVphnNVw+qAyCvMinx9+0qb8vAumyxD5FfAHXDG9z8y3WbTy4TfatSgrdZhzMeCXyWPfUgZmsFK5byHASm/XPL9HTtJDaTaHgy2QSGzEz5itf6lqFZ0+KaOS8bpqJirUSUr4D3v+P7ePZ8mN9mvi15p6191f/yZP4BgUkQc= 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 1564002481976221.38034311998206; Wed, 24 Jul 2019 14:08:01 -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 E0D5330C585C; Wed, 24 Jul 2019 21:08:00 +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 B9AF85C652; Wed, 24 Jul 2019 21:08: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 856B619730; Wed, 24 Jul 2019 21:08:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6OL7im2003692 for ; Wed, 24 Jul 2019 17:07:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id B414E5D967; Wed, 24 Jul 2019 21:07:44 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F89E5DA34 for ; Wed, 24 Jul 2019 21:07:44 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 24 Jul 2019 23:07:33 +0200 Message-Id: <8e5db3a314a40d5988108ccf7f527badf358fcda.1564002117.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/9] qemu: blockjob: Esure that persistent definition source does not copy irrelevant data 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.46]); Wed, 24 Jul 2019 21:08:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Since we copy everything from the original storage source including some runtime data which are not relevant for the config we should clear them. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index f9e79db131..f5574b7e03 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -433,6 +433,25 @@ qemuBlockJobEmitEvents(virQEMUDriverPtr driver, virObjectEventStateQueue(driver->domainEventState, event2); } +/** + * qemuBlockJobCleanStorageSourceRuntime: + * @src: storage source to clean from runtime data + * + * Remove all runtime related data from the storage source. + */ +static void +qemuBlockJobCleanStorageSourceRuntime(virStorageSourcePtr src) +{ + src->id =3D 0; + src->detected =3D false; + VIR_FREE(src->relPath); + VIR_FREE(src->backingStoreRaw); + VIR_FREE(src->nodestorage); + VIR_FREE(src->nodeformat); + VIR_FREE(src->tlsAlias); + VIR_FREE(src->tlsCertdir); +} + /** * qemuBlockJobRewriteConfigDiskSource: @@ -467,6 +486,8 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm, return; } + qemuBlockJobCleanStorageSourceRuntime(copy); + virObjectUnref(persistDisk->src); VIR_STEAL_PTR(persistDisk->src, copy); } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 00:17:21 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=1564002482; cv=none; d=zoho.com; s=zohoarc; b=AeeZFa0INwzEdRXMIEZySBjTmVvi8TkcAMb5WBqUqBOWst+QfnEWHZLaW3ifZVQUn5gSQgB0YrD6OHLDLXivpudCE32kiwcLh+v0VIYexvF8XDUsN2S2F53/LSQH1cAT5x1zpcEFeo7ZfYmOtq75ERDH1h4D6n0IeK8+5lwssek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564002482; 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=abGIdQOKtkK+QlMU9DsdPdyQDufxkN03dg8psM4nMEg=; b=UDBEuI38vO4Tf0DY44bcNY+VDXmsfzj/371hG5L2SAayx30yeERUULwGvoXz3o78mpzaS7lCvNHoZQFr9q0fX5gyiaCR7IenS9Ae/CULf/389R5EHhYz7DqiscOT+Pnvl9j1+bcu19xIDzX7fs+gr5GsQ1G/RYBlcnHBz4aIgJg= 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 156400248200453.951530801351396; Wed, 24 Jul 2019 14:08:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D807F3DBC5; Wed, 24 Jul 2019 21:08: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 B5B3518EF7; Wed, 24 Jul 2019 21:08: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 7DDC9180020F; Wed, 24 Jul 2019 21:08:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6OL7j4g003699 for ; Wed, 24 Jul 2019 17:07:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 801785D967; Wed, 24 Jul 2019 21:07:45 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B6CD5DA34 for ; Wed, 24 Jul 2019 21:07:44 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 24 Jul 2019 23:07:34 +0200 Message-Id: <73c5a0d2b85672696f0f9d297e36d7a4561d644f.1564002117.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/9] qemu: blockjob: Ensure that config disk source is identical when modifying it 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 24 Jul 2019 21:08:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" qemuBlockJobRewriteConfigDiskSource rewrites the disk source only according to the 'target'. This means that if someone would change the inactive config of the VM to refer to a different disk a block job would rewrite it when finishing a job which modifies the disk source. Make sure that this does not happen by verifying that the source of the config disk is the same. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index f5574b7e03..0c0ae89f10 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -479,6 +479,9 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm, if (!(persistDisk =3D virDomainDiskByName(vm->newDef, disk->dst, false= ))) return; + if (!virStorageSourceIsSameLocation(disk->src, persistDisk->src)) + return; + if (!(copy =3D virStorageSourceCopy(newsrc, false)) || virStorageSourceInitChainElement(copy, persistDisk->src, true) < 0= ) { VIR_WARN("Unable to update persistent definition on vm %s after bl= ock job", --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 00:17:21 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=1564002482; cv=none; d=zoho.com; s=zohoarc; b=YVRs0/dSXJ6lx4XqvSOckGinil7n9YWWsxtti0VakDRhPbl9BnsagIop/lRMyIRYSnuixCthCdTwaTaFSAX6EHaF/PqpPLoGQJKq2cx0PCHEbWh4OvrkT55idTM52MdMGimDAvbqfYgpphMhUUDs1XCQtkWSi2Gzc3cpBPCvLus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564002482; 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=Tr7vxlQklZyGpMoOrKLGq4ILxlJ+MCFMw22DZ4pZMh0=; b=eUNlTD1HL2IR7lKhRp4O699uuXi1cY6Y3VpU42Vsh8Bt+hsKNXgQWKpFLkVfO7AziDMhm1WaK0RH8txuReD6lPvtofTKuHd2nGuPCeMzIAPDki7GH0D4BvfHbCrkb1PuboKYg1pZ7mpvqdfKS8jTEGsyDd7oHFCSWvASkySvhDk= 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 1564002482405791.6386717047736; Wed, 24 Jul 2019 14:08:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6B1730C62A8; Wed, 24 Jul 2019 21:08:00 +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 BEBA8605C3; Wed, 24 Jul 2019 21:08: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 8AE3D19732; Wed, 24 Jul 2019 21:08:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6OL7kLH003707 for ; Wed, 24 Jul 2019 17:07:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 71EC95D967; Wed, 24 Jul 2019 21:07:46 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBC5D5DA34 for ; Wed, 24 Jul 2019 21:07:45 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 24 Jul 2019 23:07:35 +0200 Message-Id: <6e200c76e51b8589aceecb3eeb0e3dbebf650b28.1564002117.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 8/9] qemu: Add -blockdev support for block pull job 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 24 Jul 2019 21:08:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Introduce the handler for finalizing a block pull job which will allow to use it with blockdev. This patch also contains some additional machinery which is required to store all the relevant job data in the status XML which will also be reused with other block job types. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_blockjob.c | 191 +++++++++++++++++- src/qemu/qemu_blockjob.h | 18 ++ src/qemu/qemu_domain.c | 77 +++++++ src/qemu/qemu_driver.c | 33 ++- .../blockjob-blockdev-in.xml | 4 + 5 files changed, 313 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 0c0ae89f10..a29af7ec48 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -26,6 +26,7 @@ #include "qemu_blockjob.h" #include "qemu_block.h" #include "qemu_domain.h" +#include "qemu_alias.h" #include "conf/domain_conf.h" #include "conf/domain_event.h" @@ -207,6 +208,35 @@ qemuBlockJobDiskNew(virDomainObjPtr vm, } +qemuBlockJobDataPtr +qemuBlockJobDiskNewPull(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr base) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + VIR_AUTOUNREF(qemuBlockJobDataPtr) job =3D NULL; + VIR_AUTOFREE(char *) jobname =3D NULL; + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virAsprintf(&jobname, "pull-%s-%s", disk->dst, disk->src->node= format) < 0) + return NULL; + } else { + if (!(jobname =3D qemuAliasDiskDriveFromDisk(disk))) + return NULL; + } + + if (!(job =3D qemuBlockJobDataNew(QEMU_BLOCKJOB_TYPE_PULL, jobname))) + return NULL; + + job->data.pull.base =3D base; + + if (qemuBlockJobRegister(job, vm, disk, true) < 0) + return NULL; + + VIR_RETURN_PTR(job); +} + + /** * qemuBlockJobDiskRegisterMirror: * @job: block job to register 'mirror' chain on @@ -630,16 +660,175 @@ qemuBlockJobEventProcessConcludedRemoveChain(virQEMU= DriverPtr driver, } +/** + * qemuBlockJobGetConfigDisk: + * @vm: domain object + * @disk: disk from the running definition + * @diskChainBottom: the last element of backing chain of @disk which is r= elevant + * + * Finds and returns the disk corresponding to @disk in the inactive defin= ition. + * The inactive disk must have the backing chain starting from the source = until + * @@diskChainBottom identical. If @diskChainBottom is NULL the whole back= ing + * chains of both @disk and the persistent config definition equivalent mu= st + * be identical. + */ +static virDomainDiskDefPtr +qemuBlockJobGetConfigDisk(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr diskChainBottom) +{ + virStorageSourcePtr disksrc =3D NULL; + virStorageSourcePtr cfgsrc =3D NULL; + virDomainDiskDefPtr ret =3D NULL; + + if (!vm->newDef || !disk) + return NULL; + + disksrc =3D disk->src; + + if (!(ret =3D virDomainDiskByName(vm->newDef, disk->dst, false))) + return NULL; + + cfgsrc =3D ret->src; + + while (disksrc && cfgsrc) { + if (!virStorageSourceIsSameLocation(disksrc, cfgsrc)) + return NULL; + + if (diskChainBottom && diskChainBottom =3D=3D disksrc) + return ret; + + disksrc =3D disksrc->backingStore; + cfgsrc =3D cfgsrc->backingStore; + } + + if (disksrc || cfgsrc) + return NULL; + + return ret; +} + + +/** + * qemuBlockJobClearConfigChain: + * @vm: domain object + * @disk: disk object from running definition of @vm + * + * In cases when the backing chain definitions of the live disk differ from + * the definition for the next start config and the backing chain would to= uch + * it we'd not be able to restore the chain in the next start config prope= rly. + * + * This function checks that the source of the running disk definition and= the + * config disk definition are the same and if such it clears the backing c= hain + * data. + */ +static void +qemuBlockJobClearConfigChain(virDomainObjPtr vm, + virDomainDiskDefPtr disk) +{ + virDomainDiskDefPtr cfgdisk =3D NULL; + + if (!vm->newDef || !disk) + return; + + if (!(cfgdisk =3D virDomainDiskByName(vm->newDef, disk->dst, false))) + return; + + if (!virStorageSourceIsSameLocation(disk->src, cfgdisk->src)) + return; + + virObjectUnref(cfgdisk->src->backingStore); + cfgdisk->src->backingStore =3D NULL; +} + + +/** + * qemuBlockJobProcessEventCompletedPull: + * @driver: qemu driver object + * @vm: domain object + * @job: job data + * @asyncJob: qemu asynchronous job type (for monitor interaction) + * + * This function executes the finalizing steps after a successful block pu= ll job + * (block-stream in qemu terminology. The pull job copies all the data fro= m the + * images in the backing chain up to the 'base' image. The 'base' image be= comes + * the backing store of the active top level image. If 'base' was not used + * everything is pulled into the top level image and the top level image w= ill + * cease to have backing store. All intermediate images between the active= image + * and base image are no longer required and can be unplugged. + */ +static void +qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuBlockJobDataPtr job, + qemuDomainAsyncJob asyncJob) +{ + virStorageSourcePtr baseparent =3D NULL; + virDomainDiskDefPtr cfgdisk =3D NULL; + virStorageSourcePtr cfgbase =3D NULL; + virStorageSourcePtr cfgbaseparent =3D NULL; + virStorageSourcePtr n; + virStorageSourcePtr tmp; + + VIR_DEBUG("pull job '%s' on VM '%s' completed", job->name, vm->def->na= me); + + /* if the job isn't associated with a disk there's nothing to do */ + if (!job->disk) + return; + + if ((cfgdisk =3D qemuBlockJobGetConfigDisk(vm, job->disk, job->data.pu= ll.base))) + cfgbase =3D cfgdisk->src->backingStore; + + if (!cfgdisk) + qemuBlockJobClearConfigChain(vm, job->disk); + + /* when pulling if 'base' is right below the top image we don't have t= o modify it */ + if (job->disk->src->backingStore =3D=3D job->data.pull.base) + return; + + if (job->data.pull.base) { + for (n =3D job->disk->src->backingStore; n && n !=3D job->data.pul= l.base; n =3D n->backingStore) { + /* find the image on top of 'base' */ + + if (cfgbase) { + cfgbaseparent =3D cfgbase; + cfgbase =3D cfgbase->backingStore; + } + + baseparent =3D n; + } + } + + tmp =3D job->disk->src->backingStore; + job->disk->src->backingStore =3D job->data.pull.base; + if (baseparent) + baseparent->backingStore =3D NULL; + qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, tmp= ); + virObjectUnref(tmp); + + if (cfgdisk) { + tmp =3D cfgdisk->src->backingStore; + cfgdisk->src->backingStore =3D cfgbase; + if (cfgbaseparent) + cfgbaseparent->backingStore =3D NULL; + virObjectUnref(tmp); + } +} + + static void qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job, virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob AT= TRIBUTE_UNUSED) + qemuDomainAsyncJob asyncJob) { switch ((qemuBlockjobState) job->newstate) { case QEMU_BLOCKJOB_STATE_COMPLETED: switch ((qemuBlockJobType) job->type) { case QEMU_BLOCKJOB_TYPE_PULL: + qemuBlockJobProcessEventCompletedPull(driver, vm, job, asyncJo= b); + break; + case QEMU_BLOCKJOB_TYPE_COMMIT: case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: case QEMU_BLOCKJOB_TYPE_COPY: diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 3299207610..d5848fb72c 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -68,6 +68,15 @@ verify((int)QEMU_BLOCKJOB_TYPE_INTERNAL =3D=3D VIR_DOMAI= N_BLOCK_JOB_TYPE_LAST); VIR_ENUM_DECL(qemuBlockjob); + +typedef struct _qemuBlockJobPullData qemuBlockJobPullData; +typedef qemuBlockJobPullData *qemuBlockJobDataPullPtr; + +struct _qemuBlockJobPullData { + virStorageSourcePtr base; +}; + + typedef struct _qemuBlockJobData qemuBlockJobData; typedef qemuBlockJobData *qemuBlockJobDataPtr; @@ -80,6 +89,10 @@ struct _qemuBlockJobData { virStorageSourcePtr chain; /* Reference to the chain the job operates = on. */ virStorageSourcePtr mirrorChain; /* reference to 'mirror' part of the = job */ + union { + qemuBlockJobPullData pull; + } data; + int type; /* qemuBlockJobType */ int state; /* qemuBlockjobState */ char *errmsg; @@ -114,6 +127,11 @@ void qemuBlockJobDiskRegisterMirror(qemuBlockJobDataPtr job) ATTRIBUTE_NONNULL(1); +qemuBlockJobDataPtr +qemuBlockJobDiskNewPull(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr base); + qemuBlockJobDataPtr qemuBlockJobDiskGetJob(virDomainDiskDefPtr disk) ATTRIBUTE_NONNULL(1); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c508f55287..ec1dda4870 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2390,6 +2390,21 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *= payload, return -1; } + switch ((qemuBlockJobType) job->type) { + case QEMU_BLOCKJOB_TYPE_PULL: + if (job->data.pull.base) + virBufferAsprintf(&childBuf, "\n", job-= >data.pull.base->nodeformat); + break; + + case QEMU_BLOCKJOB_TYPE_COMMIT: + case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: + case QEMU_BLOCKJOB_TYPE_COPY: + case QEMU_BLOCKJOB_TYPE_NONE: + case QEMU_BLOCKJOB_TYPE_INTERNAL: + case QEMU_BLOCKJOB_TYPE_LAST: + break; + } + return virXMLFormatElement(data->buf, "blockjob", &attrBuf, &childBuf); } @@ -2793,6 +2808,64 @@ qemuDomainObjPrivateXMLParseBlockjobChain(xmlNodePtr= node, } +static void +qemuDomainObjPrivateXMLParseBlockjobNodename(qemuBlockJobDataPtr job, + const char *xpath, + virStorageSourcePtr *src, + xmlXPathContextPtr ctxt) +{ + VIR_AUTOFREE(char *) nodename =3D NULL; + + *src =3D NULL; + + if (!(nodename =3D virXPathString(xpath, ctxt))) + return; + + if (job->disk && + (*src =3D virStorageSourceFindByNodeName(job->disk->src, nodename,= NULL))) + return; + + if (job->chain && + (*src =3D virStorageSourceFindByNodeName(job->chain, nodename, NUL= L))) + return; + + if (job->mirrorChain && + (*src =3D virStorageSourceFindByNodeName(job->mirrorChain, nodenam= e, NULL))) + return; + + /* the node was in the XML but was not found in the job definitions */ + VIR_DEBUG("marking block job '%s' as invalid: node name '%s' missing", + job->name, nodename); + job->invalidData =3D true; +} + + +static void +qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job, + xmlXPathContextPtr ctxt) +{ + switch ((qemuBlockJobType) job->type) { + case QEMU_BLOCKJOB_TYPE_PULL: + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./base/@n= ode)", + &job->data.pull.b= ase, + ctxt); + /* base is not present if pulling everything */ + break; + + case QEMU_BLOCKJOB_TYPE_COMMIT: + case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: + case QEMU_BLOCKJOB_TYPE_COPY: + case QEMU_BLOCKJOB_TYPE_NONE: + case QEMU_BLOCKJOB_TYPE_INTERNAL: + case QEMU_BLOCKJOB_TYPE_LAST: + break; + } + + return; +} + + static int qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm, xmlNodePtr node, @@ -2863,10 +2936,14 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainO= bjPtr vm, job->errmsg =3D virXPathString("string(./errmsg)", ctxt); job->invalidData =3D invalidData; job->disk =3D disk; + if (invalidData) + VIR_DEBUG("marking block job '%s' as invalid: basic data broken", = job->name); if (mirror) qemuBlockJobDiskRegisterMirror(job); + qemuDomainObjPrivateXMLParseBlockjobDataSpecific(job, ctxt); + if (qemuBlockJobRegister(job, vm, disk, false) < 0) return -1; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b6d705b679..705c1a06c0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17040,7 +17040,8 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver, unsigned int flags) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - VIR_AUTOFREE(char *) device =3D NULL; + const char *device =3D NULL; + const char *jobname =3D NULL; virDomainDiskDefPtr disk; virStorageSourcePtr baseSource =3D NULL; unsigned int baseIndex =3D 0; @@ -17048,6 +17049,8 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver, VIR_AUTOFREE(char *) backingPath =3D NULL; unsigned long long speed =3D bandwidth; qemuBlockJobDataPtr job =3D NULL; + bool persistjob =3D false; + const char *nodebase =3D NULL; int ret =3D -1; if (flags & VIR_DOMAIN_BLOCK_REBASE_RELATIVE && !base) { @@ -17066,9 +17069,6 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver, if (!(disk =3D qemuDomainDiskByName(vm->def, path))) goto endjob; - if (!(device =3D qemuAliasDiskDriveFromDisk(disk))) - goto endjob; - if (qemuDomainDiskBlockJobIsActive(disk)) goto endjob; @@ -17111,16 +17111,31 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver, speed <<=3D 20; } - if (!(job =3D qemuBlockJobDiskNew(vm, disk, QEMU_BLOCKJOB_TYPE_PULL, d= evice))) + if (!(job =3D qemuBlockJobDiskNewPull(vm, disk, baseSource))) goto endjob; + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + jobname =3D job->name; + persistjob =3D true; + if (baseSource) { + nodebase =3D baseSource->nodeformat; + if (!backingPath && + !(backingPath =3D qemuBlockGetBackingStoreString(baseSourc= e))) + goto endjob; + } + device =3D disk->src->nodeformat; + } else { + device =3D job->name; + } + qemuDomainObjEnterMonitor(driver, vm); - if (baseSource) + if (baseSource && !jobname) basePath =3D qemuMonitorDiskNameLookup(priv->mon, device, disk->sr= c, baseSource); - if (!baseSource || basePath) - ret =3D qemuMonitorBlockStream(priv->mon, device, NULL, false, bas= ePath, - NULL, backingPath, speed); + + if (!baseSource || basePath || jobname) + ret =3D qemuMonitorBlockStream(priv->mon, device, jobname, persist= job, basePath, + nodebase, backingPath, speed); if (qemuDomainObjExitMonitor(driver, vm) < 0) ret =3D -1; diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/q= emustatusxml2xmldata/blockjob-blockdev-in.xml index 7b9282d059..e962b837ac 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -234,6 +234,10 @@ + + + + --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 00:17:21 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=1564002487; cv=none; d=zoho.com; s=zohoarc; b=OJc/HJ59JvN+vMFXSWfBKzaak0VY8NmAvO0j/jm2S1P+b4ed3AO/h6pl1/tZfsQrSkYijZCYY0TwP0CJ98TadSdnggpafNcE7Y2D7Whm4lwu2kkJCvuhLMg1lhbL8RXuHdnpSn0Ssx8eCihJOFG2KxRhl2wuq/++NM8Ildh+W9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564002487; 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=JbzJEOFlnnmvu/f6sO7PoDRJ3PYcCEib/6yeF4PhJro=; b=X2vBmS3CtzLQpi6OqDQOZpW9koLpGRSVjGALKlMU0D68FRZ0rUbDy7DwLGj6E7O6xiG5cOqpWwk5xyeHZvkMyn3nB7M+Ew5pqppJHUCR0ezWaRVzelxVC2h52wcfn06zq6vVnic9SQC5WgdBrjddoCFzKfZOLjz0KMMTHx2zIhA= 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 1564002487360631.084570462614; Wed, 24 Jul 2019 14:08:07 -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 41207C024AED; Wed, 24 Jul 2019 21:08:06 +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 197375C3FD; Wed, 24 Jul 2019 21:08:06 +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 D166019735; Wed, 24 Jul 2019 21:08:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6OL7lQi003718 for ; Wed, 24 Jul 2019 17:07:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3F3ED5D968; Wed, 24 Jul 2019 21:07:47 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDB695D967 for ; Wed, 24 Jul 2019 21:07:46 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 24 Jul 2019 23:07:36 +0200 Message-Id: <6a853000abf6e0b50e186fd0a0e579fe8242cd1c.1564002117.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 9/9] qemu: Add -blockdev support for block commit job 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]); Wed, 24 Jul 2019 21:08:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Introduce the handler for finalizing a block commit and active bloc commit job which will allow to use it with blockdev. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_blockjob.c | 212 ++++++++++++++++++ src/qemu/qemu_blockjob.h | 18 ++ src/qemu/qemu_domain.c | 32 +++ src/qemu/qemu_driver.c | 50 +++-- .../blockjob-blockdev-in.xml | 15 ++ 5 files changed, 311 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index a29af7ec48..4cbdc34b66 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -237,6 +237,43 @@ qemuBlockJobDiskNewPull(virDomainObjPtr vm, } +qemuBlockJobDataPtr +qemuBlockJobDiskNewCommit(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr topparent, + virStorageSourcePtr top, + virStorageSourcePtr base) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + VIR_AUTOUNREF(qemuBlockJobDataPtr) job =3D NULL; + VIR_AUTOFREE(char *) jobname =3D NULL; + qemuBlockJobType jobtype =3D QEMU_BLOCKJOB_TYPE_COMMIT; + + if (topparent =3D=3D NULL) + jobtype =3D QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT; + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virAsprintf(&jobname, "commit-%s-%s", disk->dst, top->nodeform= at) < 0) + return NULL; + } else { + if (!(jobname =3D qemuAliasDiskDriveFromDisk(disk))) + return NULL; + } + + if (!(job =3D qemuBlockJobDataNew(jobtype, jobname))) + return NULL; + + job->data.commit.topparent =3D topparent; + job->data.commit.top =3D top; + job->data.commit.base =3D base; + + if (qemuBlockJobRegister(job, vm, disk, true) < 0) + return NULL; + + VIR_RETURN_PTR(job); +} + + /** * qemuBlockJobDiskRegisterMirror: * @job: block job to register 'mirror' chain on @@ -816,6 +853,167 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPt= r driver, } +/** + * qemuBlockJobProcessEventCompletedCommit: + * @driver: qemu driver object + * @vm: domain object + * @job: job data + * @asyncJob: qemu asynchronous job type (for monitor interaction) + * + * This function executes the finalizing steps after a successful block co= mmit + * job. The commit job moves the blocks from backing chain images starting= from + * 'top' into the 'base' image. The overlay of the 'top' image ('topparent= ') + * then directly references the 'base' image. All intermediate images can = be + * removed/deleted. + */ +static void +qemuBlockJobProcessEventCompletedCommit(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuBlockJobDataPtr job, + qemuDomainAsyncJob asyncJob) +{ + virStorageSourcePtr baseparent =3D NULL; + virDomainDiskDefPtr cfgdisk =3D NULL; + virStorageSourcePtr cfgnext =3D NULL; + virStorageSourcePtr cfgtopparent =3D NULL; + virStorageSourcePtr cfgtop =3D NULL; + virStorageSourcePtr cfgbase =3D NULL; + virStorageSourcePtr cfgbaseparent =3D NULL; + virStorageSourcePtr n; + + VIR_DEBUG("commit job '%s' on VM '%s' completed", job->name, vm->def->= name); + + /* if the job isn't associated with a disk there's nothing to do */ + if (!job->disk) + return; + + if ((cfgdisk =3D qemuBlockJobGetConfigDisk(vm, job->disk, job->data.co= mmit.base))) + cfgnext =3D cfgdisk->src; + + if (!cfgdisk) + qemuBlockJobClearConfigChain(vm, job->disk); + + for (n =3D job->disk->src; n && n !=3D job->data.commit.base; n =3D n-= >backingStore) { + if (cfgnext) { + if (n =3D=3D job->data.commit.topparent) + cfgtopparent =3D cfgnext; + + if (n =3D=3D job->data.commit.top) + cfgtop =3D cfgnext; + + cfgbaseparent =3D cfgnext; + cfgnext =3D cfgnext->backingStore; + } + baseparent =3D n; + } + + if (!n) + return; + + /* revert access to images */ + qemuDomainStorageSourceAccessAllow(driver, vm, job->data.commit.base, = true, false); + if (job->data.commit.topparent !=3D job->disk->src) + qemuDomainStorageSourceAccessAllow(driver, vm, job->data.commit.to= pparent, true, false); + + baseparent->backingStore =3D NULL; + job->data.commit.topparent->backingStore =3D job->data.commit.base; + + qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, job= ->data.commit.top); + virObjectUnref(job->data.commit.top); + job->data.commit.top =3D NULL; + + if (cfgbaseparent) { + cfgbase =3D cfgbaseparent->backingStore; + cfgbaseparent->backingStore =3D NULL; + + if (cfgtopparent) + cfgtopparent->backingStore =3D cfgbase; + else + cfgdisk->src =3D cfgbase; + + virObjectUnref(cfgtop); + } +} + + +/** + * qemuBlockJobProcessEventCompletedActiveCommit: + * @driver: qemu driver object + * @vm: domain object + * @job: job data + * @asyncJob: qemu asynchronous job type (for monitor interaction) + * + * This function executes the finalizing steps after a successful active l= ayer + * block commit job. The commit job moves the blocks from backing chain im= ages + * starting from the active disk source image into the 'base' image. The d= isk + * source then changes to the 'base' image. All intermediate images can be + * removed/deleted. + */ +static void +qemuBlockJobProcessEventCompletedActiveCommit(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuBlockJobDataPtr job, + qemuDomainAsyncJob asyncJob) +{ + virStorageSourcePtr baseparent =3D NULL; + virDomainDiskDefPtr cfgdisk =3D NULL; + virStorageSourcePtr cfgnext =3D NULL; + virStorageSourcePtr cfgtop =3D NULL; + virStorageSourcePtr cfgbase =3D NULL; + virStorageSourcePtr cfgbaseparent =3D NULL; + virStorageSourcePtr n; + + VIR_DEBUG("active commit job '%s' on VM '%s' completed", job->name, vm= ->def->name); + + /* if the job isn't associated with a disk there's nothing to do */ + if (!job->disk) + return; + + if ((cfgdisk =3D qemuBlockJobGetConfigDisk(vm, job->disk, job->data.co= mmit.base))) + cfgnext =3D cfgdisk->src; + + for (n =3D job->disk->src; n && n !=3D job->data.commit.base; n =3D n-= >backingStore) { + if (cfgnext) { + if (n =3D=3D job->data.commit.top) + cfgtop =3D cfgnext; + + cfgbaseparent =3D cfgnext; + cfgnext =3D cfgnext->backingStore; + } + baseparent =3D n; + } + + if (!n) + return; + + if (!cfgdisk) { + /* in case when the config disk chain didn't match but the disk to= p seems + * to be identical we need to modify the disk source since the act= ive + * commit makes the top level image invalid. + */ + qemuBlockJobRewriteConfigDiskSource(vm, job->disk, job->data.commi= t.base); + } else { + cfgbase =3D cfgbaseparent->backingStore; + cfgbaseparent->backingStore =3D NULL; + cfgdisk->src =3D cfgbase; + virObjectUnref(cfgtop); + } + + /* Move security driver metadata */ + if (qemuSecurityMoveImageMetadata(driver, vm, job->disk->src, job->dat= a.commit.base) < 0) + VIR_WARN("Unable to move disk metadata on vm %s", vm->def->name); + + baseparent->backingStore =3D NULL; + job->disk->src =3D job->data.commit.base; + + qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, job= ->data.commit.top); + virObjectUnref(job->data.commit.top); + job->data.commit.top =3D NULL; + /* the mirror element does not serve functional purpose for the commit= job */ + virObjectUnref(job->disk->mirror); + job->disk->mirror =3D NULL; +} + static void qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job, virQEMUDriverPtr driver, @@ -830,7 +1028,13 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlock= JobDataPtr job, break; case QEMU_BLOCKJOB_TYPE_COMMIT: + qemuBlockJobProcessEventCompletedCommit(driver, vm, job, async= Job); + break; + case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: + qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job,= asyncJob); + break; + case QEMU_BLOCKJOB_TYPE_COPY: case QEMU_BLOCKJOB_TYPE_NONE: case QEMU_BLOCKJOB_TYPE_INTERNAL: @@ -845,7 +1049,15 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlock= JobDataPtr job, switch ((qemuBlockJobType) job->type) { case QEMU_BLOCKJOB_TYPE_PULL: case QEMU_BLOCKJOB_TYPE_COMMIT: + break; + case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: + if (job->disk) { + virObjectUnref(job->disk->mirror); + job->disk->mirror =3D NULL; + } + break; + case QEMU_BLOCKJOB_TYPE_COPY: case QEMU_BLOCKJOB_TYPE_NONE: case QEMU_BLOCKJOB_TYPE_INTERNAL: diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index d5848fb72c..8139a1a324 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -77,6 +77,16 @@ struct _qemuBlockJobPullData { }; +typedef struct _qemuBlockJobCommitData qemuBlockJobCommitData; +typedef qemuBlockJobCommitData *qemuBlockJobDataCommitPtr; + +struct _qemuBlockJobCommitData { + virStorageSourcePtr topparent; + virStorageSourcePtr top; + virStorageSourcePtr base; +}; + + typedef struct _qemuBlockJobData qemuBlockJobData; typedef qemuBlockJobData *qemuBlockJobDataPtr; @@ -91,6 +101,7 @@ struct _qemuBlockJobData { union { qemuBlockJobPullData pull; + qemuBlockJobCommitData commit; } data; int type; /* qemuBlockJobType */ @@ -132,6 +143,13 @@ qemuBlockJobDiskNewPull(virDomainObjPtr vm, virDomainDiskDefPtr disk, virStorageSourcePtr base); +qemuBlockJobDataPtr +qemuBlockJobDiskNewCommit(virDomainObjPtr vm, + virDomainDiskDefPtr disk, + virStorageSourcePtr topparent, + virStorageSourcePtr top, + virStorageSourcePtr base); + qemuBlockJobDataPtr qemuBlockJobDiskGetJob(virDomainDiskDefPtr disk) ATTRIBUTE_NONNULL(1); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ec1dda4870..26a951b6d3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2398,6 +2398,12 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *= payload, case QEMU_BLOCKJOB_TYPE_COMMIT: case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: + if (job->data.commit.base) + virBufferAsprintf(&childBuf, "\n", job-= >data.commit.base->nodeformat); + if (job->data.commit.top) + virBufferAsprintf(&childBuf, "\n", job->= data.commit.top->nodeformat); + if (job->data.commit.topparent) + virBufferAsprintf(&childBuf, "\n",= job->data.commit.topparent->nodeformat); case QEMU_BLOCKJOB_TYPE_COPY: case QEMU_BLOCKJOB_TYPE_NONE: case QEMU_BLOCKJOB_TYPE_INTERNAL: @@ -2854,7 +2860,29 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qem= uBlockJobDataPtr job, break; case QEMU_BLOCKJOB_TYPE_COMMIT: + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./toppare= nt/@node)", + &job->data.commit= .topparent, + ctxt); + + if (!job->data.commit.topparent) + goto broken; + + ATTRIBUTE_FALLTHROUGH; case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./top/@no= de)", + &job->data.commit= .top, + ctxt); + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./base/@n= ode)", + &job->data.commit= .base, + ctxt); + if (!job->data.commit.top || + !job->data.commit.base) + goto broken; + break; + case QEMU_BLOCKJOB_TYPE_COPY: case QEMU_BLOCKJOB_TYPE_NONE: case QEMU_BLOCKJOB_TYPE_INTERNAL: @@ -2863,6 +2891,10 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qem= uBlockJobDataPtr job, } return; + + broken: + VIR_DEBUG("marking block job '%s' as invalid: malformed job data", job= ->name); + job->invalidData =3D true; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 705c1a06c0..79d13674c6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17939,7 +17939,8 @@ qemuDomainBlockCommit(virDomainPtr dom, virQEMUDriverPtr driver =3D dom->conn->privateData; qemuDomainObjPrivatePtr priv; virDomainObjPtr vm =3D NULL; - VIR_AUTOFREE(char *) device =3D NULL; + const char *device =3D NULL; + const char *jobname =3D NULL; int ret =3D -1; virDomainDiskDefPtr disk =3D NULL; virStorageSourcePtr topSource; @@ -17953,8 +17954,10 @@ qemuDomainBlockCommit(virDomainPtr dom, VIR_AUTOFREE(char *) backingPath =3D NULL; unsigned long long speed =3D bandwidth; qemuBlockJobDataPtr job =3D NULL; - qemuBlockJobType jobtype =3D QEMU_BLOCKJOB_TYPE_COMMIT; VIR_AUTOUNREF(virStorageSourcePtr) mirror =3D NULL; + const char *nodetop =3D NULL; + const char *nodebase =3D NULL; + bool persistjob =3D false; /* XXX Add support for COMMIT_DELETE */ virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | @@ -17989,9 +17992,6 @@ qemuDomainBlockCommit(virDomainPtr dom, if (!(disk =3D qemuDomainDiskByName(vm->def, path))) goto endjob; - if (!(device =3D qemuAliasDiskDriveFromDisk(disk))) - goto endjob; - if (virStorageSourceIsEmpty(disk->src)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk %s has no source file to be committed"), @@ -18023,8 +18023,6 @@ qemuDomainBlockCommit(virDomainPtr dom, disk->dst); goto endjob; } - - jobtype =3D QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT; } else if (flags & VIR_DOMAIN_BLOCK_COMMIT_ACTIVE) { virReportError(VIR_ERR_INVALID_ARG, _("active commit requested but '%s' is not active"), @@ -18097,7 +18095,8 @@ qemuDomainBlockCommit(virDomainPtr dom, qemuDomainStorageSourceAccessAllow(driver, vm, top_parent, false,= false) < 0)) goto endjob; - if (!(job =3D qemuBlockJobDiskNew(vm, disk, jobtype, device))) + if (!(job =3D qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSourc= e, + baseSource))) goto endjob; disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_NONE; @@ -18107,15 +18106,34 @@ qemuDomainBlockCommit(virDomainPtr dom, * depending on whether the input was specified as relative or * absolute (that is, our absolute top_canon may do the wrong * thing if the user specified a relative name). */ + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + persistjob =3D true; + jobname =3D job->name; + nodetop =3D topSource->nodeformat; + nodebase =3D baseSource->nodeformat; + device =3D disk->src->nodeformat; + if (!backingPath && top_parent && + !(backingPath =3D qemuBlockGetBackingStoreString(baseSource))) + goto endjob; + } else { + device =3D job->name; + } + qemuDomainObjEnterMonitor(driver, vm); - basePath =3D qemuMonitorDiskNameLookup(priv->mon, device, disk->src, - baseSource); - topPath =3D qemuMonitorDiskNameLookup(priv->mon, device, disk->src, - topSource); - if (basePath && topPath) - ret =3D qemuMonitorBlockCommit(priv->mon, device, NULL, false, - topPath, NULL, basePath, NULL, backin= gPath, - speed); + + if (!jobname) { + basePath =3D qemuMonitorDiskNameLookup(priv->mon, device, disk->sr= c, + baseSource); + topPath =3D qemuMonitorDiskNameLookup(priv->mon, device, disk->src, + topSource); + } + + if ((basePath && topPath) || jobname) + ret =3D qemuMonitorBlockCommit(priv->mon, device, jobname, persist= job, + topPath, nodetop, basePath, nodebase, + backingPath, speed); + if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) { ret =3D -1; goto endjob; diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/q= emustatusxml2xmldata/blockjob-blockdev-in.xml index e962b837ac..d06bbb7059 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -238,6 +238,17 @@ + + + + + + + + + + + @@ -581,6 +592,10 @@ + + + +
--=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list