c1c534
From cf8fcc97c173618534874046d2f29d4135cf2441 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <cf8fcc97c173618534874046d2f29d4135cf2441@dist-git>
c1c534
From: Peter Krempa <pkrempa@redhat.com>
c1c534
Date: Fri, 8 Dec 2017 10:27:03 +0100
c1c534
Subject: [PATCH] qemu: blockjob: Reset disk source index after pivot
c1c534
c1c534
Since we are re-detecting the backing chain after pivoting to the active
c1c534
block commit target (or block copy target) the disk index needs to be
c1c534
reset to 0. This is necessary since we move a member of the backing
c1c534
chain to disk->src but clear indexes only starting from
c1c534
disk->src->backingStore. The freshly detected images have indexes
c1c534
starting from 1, but since we've pivoted into an image which was
c1c534
previously a backing store it would have a non-0 index.
c1c534
The lookup function would then return the top of the chain for queries
c1c534
like 'vda[1]' instead of the first backing store.
c1c534
c1c534
This problem will not be present once we keep the disk indexes stable.
c1c534
c1c534
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1519745
c1c534
(cherry picked from commit fac8724ceb371f962d5d185c639456a34d71659e)
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_blockjob.c | 1 +
c1c534
 1 file changed, 1 insertion(+)
c1c534
c1c534
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
c1c534
index c1b46f7d0a..afc05f161c 100644
c1c534
--- a/src/qemu/qemu_blockjob.c
c1c534
+++ b/src/qemu/qemu_blockjob.c
c1c534
@@ -165,6 +165,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
c1c534
         disk->mirror = NULL;
c1c534
         disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
c1c534
         disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
c1c534
+        disk->src->id = 0;
c1c534
         ignore_value(qemuDomainDetermineDiskChain(driver, vm, disk,
c1c534
                                                   true, true));
c1c534
         ignore_value(qemuBlockNodeNamesDetect(driver, vm, asyncJob));
c1c534
-- 
c1c534
2.15.1
c1c534