提交 49ea62e5 编写于 作者: P Peter Krempa

qemu: fix broken handling of shallow flag in qemuDomainBlockCopyCommon

Commit 16ca234b refactored how the 'shallow' and 'reuse' flags
are accessed but neglected to fix the clearing of 'shallow' in case when
the disk has no backing chain. This means that we'd request a shallow
copy even without backing chain and also a few checks would work wrong.

Fix it by using the extracted variable everywhere.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 32bd092b
......@@ -18299,12 +18299,9 @@ qemuDomainBlockCopyValidateMirror(virStorageSourcePtr mirror,
*/
static int
qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(virStorageSourcePtr mirror,
unsigned int flags,
bool shallow,
bool blockdev)
{
/* note that if original disk does not have backing chain, shallow is cleared */
bool shallow = flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW;
if (!virStorageSourceHasBacking(mirror)) {
/* for deep copy there won't be backing chain so we can terminate it */
if (!mirror->backingStore &&
......@@ -18417,9 +18414,10 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
/* clear the _SHALLOW flag if there is only one layer */
if (!virStorageSourceHasBacking(disk->src))
flags &= ~VIR_DOMAIN_BLOCK_COPY_SHALLOW;
mirror_shallow = false;
if (qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(mirror, flags,
if (qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(mirror,
mirror_shallow,
blockdev) < 0)
goto endjob;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册