From nobody Sun Feb 8 14:41:49 2026 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.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; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1497956234882153.3514473862832; Tue, 20 Jun 2017 03:57:14 -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 D33B57DCC4; Tue, 20 Jun 2017 10:57:12 +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 8DAD66DC8E; Tue, 20 Jun 2017 10:57: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 4461C4A492; Tue, 20 Jun 2017 10:57:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5KAv6rP020771 for ; Tue, 20 Jun 2017 06:57:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id A0B1889401; Tue, 20 Jun 2017 10:57:06 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6BB9893FC; Tue, 20 Jun 2017 10:57:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D33B57DCC4 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D33B57DCC4 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 20 Jun 2017 12:56:56 +0200 Message-Id: <55bb7fb903eabf339a24c3a30de2d18a66ae2d4b.1497956176.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 5/5] qemu: snapshot: Load data necessary for relative block commit to work 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: , MIME-Version: 1.0 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.27]); Tue, 20 Jun 2017 10:57:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit 7456c4f5f introduced a regression by not reloading the backing chain of a disk after snapshot. The regression was caused as src->relPath was not set and thus the block commit code could not determine the relative path. This patch adds code that will load the backing store string if VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT and store it in the correct place when a snapshot is successfully completed. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1461303 --- src/qemu/qemu_driver.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4f62c1a7a..e91663ca9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14091,6 +14091,7 @@ struct _qemuDomainSnapshotDiskData { bool created; /* @src was created by the snapshot code */ bool prepared; /* @src was prepared using qemuDomainDiskChainElementPr= epare */ virDomainDiskDefPtr disk; + char *relPath; /* relative path component to fill into original disk */ virStorageSourcePtr persistsrc; virDomainDiskDefPtr persistdisk; @@ -14124,6 +14125,7 @@ qemuDomainSnapshotDiskDataFree(qemuDomainSnapshotDi= skDataPtr data, virStorageSourceFree(data[i].src); } virStorageSourceFree(data[i].persistsrc); + VIR_FREE(data[i].relPath); } VIR_FREE(data); @@ -14139,11 +14141,13 @@ qemuDomainSnapshotDiskDataFree(qemuDomainSnapshot= DiskDataPtr data, static qemuDomainSnapshotDiskDataPtr qemuDomainSnapshotDiskDataCollect(virQEMUDriverPtr driver, virDomainObjPtr vm, - virDomainSnapshotObjPtr snap) + virDomainSnapshotObjPtr snap, + bool reuse) { size_t i; qemuDomainSnapshotDiskDataPtr ret; qemuDomainSnapshotDiskDataPtr dd; + char *backingStoreStr; if (VIR_ALLOC_N(ret, snap->def->ndisks) < 0) return NULL; @@ -14167,6 +14171,16 @@ qemuDomainSnapshotDiskDataCollect(virQEMUDriverPtr= driver, dd->initialized =3D true; + /* relative backing store paths need to be updated so that relative + * block commit still works */ + if (reuse && + (backingStoreStr =3D virStorageFileGetBackingStoreStr(dd->src)= )) { + if (virStorageIsRelative(backingStoreStr)) + VIR_STEAL_PTR(dd->relPath, backingStoreStr); + else + VIR_FREE(backingStoreStr); + } + /* Note that it's unsafe to assume that the disks in the persistent * definition match up with the disks in the live definition just = by * checking that the target name is the same. We've done that @@ -14210,6 +14224,7 @@ qemuDomainSnapshotUpdateDiskSources(qemuDomainSnaps= hotDiskDataPtr dd, if (dd->initialized) virStorageFileDeinit(dd->src); + VIR_STEAL_PTR(dd->disk->src->relPath, dd->relPath); VIR_STEAL_PTR(dd->src->backingStore, dd->disk->src); VIR_STEAL_PTR(dd->disk->src, dd->src); @@ -14323,7 +14338,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, /* prepare a list of objects to use in the vm definition so that we do= n't * have to roll back later */ - if (!(diskdata =3D qemuDomainSnapshotDiskDataCollect(driver, vm, snap)= )) + if (!(diskdata =3D qemuDomainSnapshotDiskDataCollect(driver, vm, snap,= reuse))) goto cleanup; cfg =3D virQEMUDriverGetConfig(driver); --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list