From: Peter Krempa Date: Tue, 3 Sep 2019 12:26:20 +0000 (+0200) Subject: qemu: driver: Fix shallow non-reuse block copy X-Git-Tag: v5.8.0-rc1~288 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=805b4aa2e9cd782072ba179939ea12872e5cee2b;p=thirdparty%2Flibvirt.git qemu: driver: Fix shallow non-reuse block copy 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 Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 39a0ee29b4..b862f727b7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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; }