From 1bb0faa51a1c364d0178adb01714f222d5442257 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 21 Sep 2020 19:38:11 +0200 Subject: [PATCH] qemuSnapshotCreateInactiveExternal: Don't access 'idx' of snapshot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- src/qemu/qemu_snapshot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index a6e091dd09..48a4e9dd41 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -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;