[PATCH 03/12] qemu: fix broken handling of shallow flag in qemuDomainBlockCopyCommon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 16ca234b56fac82 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: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3e0aa1b90f..2c03cc5dff 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18258,12 +18258,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 &&
@@ -18376,9 +18373,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;

-- 
2.21.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux