Re: [libvirt] [PATCH 6/7] qemu: snapshot: Initialize data for inactive config of snapshot earlier

2019-07-25 Thread Ján Tomko

On Tue, Jul 23, 2019 at 02:08:50PM +0200, Peter Krempa wrote:

qemuDomainSnapshotDiskDataCollect copies the source of the disk from the
live config into the inactive config. Move this operation earlier so
that if we initialize it for use for the particular instance the
run-time-only data is not copied.

Signed-off-by: Peter Krempa 
---
src/qemu/qemu_driver.c | 32 
1 file changed, 16 insertions(+), 16 deletions(-)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 6/7] qemu: snapshot: Initialize data for inactive config of snapshot earlier

2019-07-23 Thread Peter Krempa
qemuDomainSnapshotDiskDataCollect copies the source of the disk from the
live config into the inactive config. Move this operation earlier so
that if we initialize it for use for the particular instance the
run-time-only data is not copied.

Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_driver.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 042efae49f..69327c148a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15114,6 +15114,22 @@ qemuDomainSnapshotDiskDataCollect(virQEMUDriverPtr 
driver,
 if (virStorageSourceInitChainElement(dd->src, dd->disk->src, false) < 
0)
 goto cleanup;

+/* 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
+ * historically this way though. */
+if (vm->newDef &&
+(dd->persistdisk = virDomainDiskByName(vm->newDef, dd->disk->dst,
+   false))) {
+
+if (!(dd->persistsrc = virStorageSourceCopy(dd->src, false)))
+goto cleanup;
+
+if (virStorageSourceInitChainElement(dd->persistsrc,
+ dd->persistdisk->src, false) 
< 0)
+goto cleanup;
+}
+
 if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0)
 goto cleanup;

@@ -15131,22 +15147,6 @@ qemuDomainSnapshotDiskDataCollect(virQEMUDriverPtr 
driver,
 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
- * historically this way though. */
-if (vm->newDef &&
-(dd->persistdisk = virDomainDiskByName(vm->newDef, dd->disk->dst,
-   false))) {
-
-if (!(dd->persistsrc = virStorageSourceCopy(dd->src, false)))
-goto cleanup;
-
-if (virStorageSourceInitChainElement(dd->persistsrc,
- dd->persistdisk->src, false) 
< 0)
-goto cleanup;
-}
 }

 VIR_STEAL_PTR(*rdata, data);
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list