[PATCH 2/5] qemu: blockcopy: Explicitly assert 'reuse' for block devices

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

 



When copying to a block device, the block device will already exist. To
allow users using a block device without any preparation, they need to
use the block copy without VIR_DOMAIN_BLOCK_COPY_REUSE_EXT.

This means that if the target is an existing block device we don't need
to prepare it, but we can't reject it as being existing.

To avoid breaking this feature, explicitly assume that existing block
devices will be reused even without that flag explicitly specified,
while skipping attempts to create it.

qemuMonitorDriveMirror still needs to honor the flag as specified by the
user, since qemu overwrites the metadata otherwise.
---
 src/qemu/qemu_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d03a9dbc3..d00166f23 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16812,6 +16812,10 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
                            disk->dst, mirror->path);
             goto endjob;
         }
+    } else {
+        /* if the target is a block device, assume that we are reusing it, so
+         * there are no attempts to create it */
+        reuse = true;
     }

     if (!mirror->format) {
@@ -16851,6 +16855,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,

     /* Actually start the mirroring */
     qemuDomainObjEnterMonitor(driver, vm);
+    /* qemuMonitorDriveMirror needs to honor the REUSE_EXT flag as specified
+     * by the user regardless of how @reuse was modified */
     ret = qemuMonitorDriveMirror(priv->mon, device, mirror->path, format,
                                  bandwidth, granularity, buf_size, flags);
     virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >= 0);
-- 
2.12.2

--
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