[libvirt] [PATCH] qemu: blockjob: Reset disk source index after pivot

Peter Krempa posted 1 patch 6 years, 4 months ago
src/qemu/qemu_blockjob.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] qemu: blockjob: Reset disk source index after pivot
Posted by Peter Krempa 6 years, 4 months ago
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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 0b1616a214..617e4ee564 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -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));
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: blockjob: Reset disk source index after pivot
Posted by Eric Blake 6 years, 4 months ago
On 12/07/2017 09:27 AM, Peter Krempa wrote:
> 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 | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list