]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuSnapshotCreateInactiveExternal: Don't access 'idx' of snapshot
authorPeter Krempa <pkrempa@redhat.com>
Mon, 21 Sep 2020 17:38:11 +0000 (19:38 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 23 Sep 2020 20:37:56 +0000 (22:37 +0200)
After virDomainSnapshotAlignDisks is called the definitions of disks in
the snapshot definition and in the domain definition are in the same
order so they can be addressed using the same index.

This frees up 'idx' to be removed later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_snapshot.c

index a6e091dd09e10961504a27e1effdfe4ae2666072..48a4e9dd41f321c2ba109cae05c6a29fe94d4c9c 100644 (file)
@@ -171,7 +171,7 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
      * create them correctly.  */
     for (i = 0; i < snapdef->ndisks && !reuse; i++) {
         snapdisk = &(snapdef->disks[i]);
-        defdisk = snapdef->parent.dom->disks[snapdisk->idx];
+        defdisk = vm->def->disks[i];
         if (snapdisk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
             continue;
 
@@ -216,7 +216,7 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
         g_autoptr(virStorageSource) newsrc = NULL;
 
         snapdisk = &(snapdef->disks[i]);
-        defdisk = vm->def->disks[snapdisk->idx];
+        defdisk = vm->def->disks[i];
 
         if (snapdisk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
             continue;