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