[PATCHv5 23/28] qemu: blockcopy: Use the mirror disk source to label the files

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

 



Use the source struct and the corresponding function so that we can
avoid using the path separately. Now that
qemuDomainPrepareDiskChainElementPath isn't use anywhere, we can safely
remove it.

Additionally, the removal fixes a misaligned comment as the removed
function was added under a comment for a different function.
---
 src/qemu/qemu_driver.c | 31 ++++++-------------------------
 1 file changed, 6 insertions(+), 25 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1bd82f0..ffc5f67 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12104,25 +12104,6 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr driver,
  * is sent but failed, and number of frozen filesystems on success. If -2 is
  * returned, FSThaw should be called revert the quiesced status. */
 static int
-qemuDomainPrepareDiskChainElementPath(virQEMUDriverPtr driver,
-                                      virDomainObjPtr vm,
-                                      virDomainDiskDefPtr disk,
-                                      const char *file,
-                                      qemuDomainDiskChainMode mode)
-{
-    virStorageSource src;
-
-    memset(&src, 0, sizeof(src));
-
-    src.type = VIR_STORAGE_TYPE_FILE;
-    src.format = VIR_STORAGE_FILE_RAW;
-    src.path = (char *) file; /* casting away const is safe here */
-
-    return qemuDomainPrepareDiskChainElement(driver, vm, disk, &src, mode);
-}
-
-
-static int
 qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver,
                            virDomainObjPtr vm,
                            const char **mountpoints,
@@ -15367,10 +15348,10 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
     if (VIR_STRDUP(mirror->path, dest) < 0)
         goto endjob;

-    if (qemuDomainPrepareDiskChainElementPath(driver, vm, disk, dest,
-                                              VIR_DISK_CHAIN_READ_WRITE) < 0) {
-        qemuDomainPrepareDiskChainElementPath(driver, vm, disk, dest,
-                                              VIR_DISK_CHAIN_NO_ACCESS);
+    if (qemuDomainPrepareDiskChainElement(driver, vm, disk, mirror,
+                                          VIR_DISK_CHAIN_READ_WRITE) < 0) {
+        qemuDomainPrepareDiskChainElement(driver, vm, disk, mirror,
+                                          VIR_DISK_CHAIN_NO_ACCESS);
         goto endjob;
     }

@@ -15381,8 +15362,8 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
     virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >= 0);
     qemuDomainObjExitMonitor(driver, vm);
     if (ret < 0) {
-        qemuDomainPrepareDiskChainElementPath(driver, vm, disk, dest,
-                                              VIR_DISK_CHAIN_NO_ACCESS);
+        qemuDomainPrepareDiskChainElement(driver, vm, disk, mirror,
+                                          VIR_DISK_CHAIN_NO_ACCESS);
         goto endjob;
     }

-- 
1.9.3

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