]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: blockjob: Reset disk source index after pivot
authorPeter Krempa <pkrempa@redhat.com>
Thu, 7 Dec 2017 15:11:18 +0000 (16:11 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 8 Dec 2017 09:13:57 +0000 (10:13 +0100)
Since we are re-detecting the backing chain after pivoting to the active
block commit target (or block copy target) the disk index needs to be
reset to 0. This is necessary since we move a member of the backing
chain to disk->src but clear indexes only starting from
disk->src->backingStore. The freshly detected images have indexes
starting from 1, but since we've pivoted into an image which was
previously a backing store it would have a non-0 index.
The lookup function would then return the top of the chain for queries
like 'vda[1]' instead of the first backing store.

This problem will not be present once we keep the disk indexes stable.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1519745

src/qemu/qemu_blockjob.c

index 0b1616a2145f38d28e6f4dd90a3186574084cf63..617e4ee5644ff8844bd2670ce2e5fad6a5583737 100644 (file)
@@ -175,6 +175,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
         disk->mirror = NULL;
         disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
         disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
+        disk->src->id = 0;
         ignore_value(qemuDomainDetermineDiskChain(driver, vm, disk,
                                                   true, true));
         ignore_value(qemuBlockNodeNamesDetect(driver, vm, asyncJob));