]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: driver: Fix shallow non-reuse block copy
authorPeter Krempa <pkrempa@redhat.com>
Tue, 3 Sep 2019 12:26:20 +0000 (14:26 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 6 Sep 2019 06:12:21 +0000 (08:12 +0200)
The code preparing data for creating/attaching the target image of block
copy didn't use the correct reference to the existing backing chain in
case when the copy should inherit it. This meant that qemu actually
opened a second copy of the chain and operated on that.

This would de-sync qemu from libvirt's view of node names. Luckily this
is only hypothetical at this point since it happens only when -blockdev
is enabled.

Fix it by passing 'mirrorBacking' which has the proper data as the
backing store when calling
qemuBuildStorageSourceChainAttachPrepareBlockdevTop.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index 39a0ee29b42d52914dfd3685a5c8f7ba27bcdb16..b862f727b73d3da6958c5be1eea92d6374e9bedc 100644 (file)
@@ -18550,10 +18550,12 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
                      * new image must refer to it in the metadata */
                     mirrorBacking = disk->src->backingStore;
                 }
+            } else {
+                mirrorBacking = mirror->backingStore;
             }
 
             if (!(crdata = qemuBuildStorageSourceChainAttachPrepareBlockdevTop(mirror,
-                                                                               mirror->backingStore,
+                                                                               mirrorBacking,
                                                                                priv->qemuCaps)))
                 goto endjob;
         }