[libvirt PATCH v2 07/10] qemu: block: add function to launch all prepared blockcommits

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

 



This is the second phase of snapshot deletion.  We have all information
necessary to delete the snapshot by running blockcommits and we haven't
detected any problems that would make the deletion unsafe.

Now we just launch the blockcommits in parallel.

Signed-off-by: Pavel Mores <pmores@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dc1176bd9c..35b7fb69d5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -154,6 +154,16 @@ static int qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
 
 static virQEMUDriverPtr qemu_driver;
 
+static int
+qemuDomainBlockCommitCommon(virDomainObjPtr vm,
+                            virQEMUDriverPtr driver,
+                            virDomainDiskDefPtr disk,
+                            virStorageSourcePtr baseSource,
+                            virStorageSourcePtr topSource,
+                            virStorageSourcePtr topParentSource,
+                            unsigned long bandwidth,
+                            unsigned int flags);
+
 static int
 qemuDomainBlockCommitImpl(virDomainObjPtr vm,
                           virQEMUDriverPtr driver,
@@ -16906,6 +16916,31 @@ qemuDomainSnapshotDeleteExternalGetJobDescriptors(virDomainObjPtr vm,
 }
 
 
+static int
+qemuDomainSnapshotDeleteExternalLaunchJobs(virDomainObjPtr vm,
+                                           virQEMUDriverPtr driver,
+                                           const virBlockCommitDesc *blockCommitDescs,
+                                           int numDescs)
+{
+    size_t i;
+
+    for (i = 0; i < numDescs; i++) {
+        virDomainDiskDefPtr disk = blockCommitDescs[i].disk;
+        virStorageSourcePtr baseSource = blockCommitDescs[i].baseSource;
+        virStorageSourcePtr topSource = blockCommitDescs[i].topSource;
+        virStorageSourcePtr topParentSource = blockCommitDescs[i].topParentSource;
+        int blockCommitFlags = blockCommitDescs[i].blockCommitFlags;
+
+        if (qemuDomainBlockCommitCommon(vm, driver, disk, baseSource,
+                                        topSource, topParentSource,
+                                        0, blockCommitFlags) < 0)
+            return -1;
+    }
+
+    return 0;
+}
+
+
 static int
 qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
                          unsigned int flags)
-- 
2.24.1





[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