[libvirt PATCH 04/30] qemu_block: add async domain job support to qemuBlockCommit

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

 



This will allow to use it while having async domain job active which we
will use when deleting external snapshots. At the same time we will need
to have the block job started as synchronous.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/qemu/qemu_block.c  | 7 ++++++-
 src/qemu/qemu_block.h  | 1 +
 src/qemu/qemu_driver.c | 3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 721145fa42..999e43c630 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3205,6 +3205,7 @@ qemuBlockCommit(virDomainObj *vm,
                 virStorageSource *topSource,
                 virStorageSource *top_parent,
                 unsigned long bandwidth,
+                virDomainAsyncJob asyncJob,
                 unsigned int flags)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
@@ -3336,7 +3337,11 @@ qemuBlockCommit(virDomainObj *vm,
         !(backingPath = qemuBlockGetBackingStoreString(baseSource, false)))
         goto error;
 
-    qemuDomainObjEnterMonitor(vm);
+    if (asyncJob != VIR_ASYNC_JOB_NONE)
+        qemuBlockJobSyncBegin(job);
+
+    if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0)
+        goto error;
 
     rc = qemuMonitorBlockCommit(priv->mon,
                                 qemuDomainDiskGetTopNodename(disk),
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 52deb15a3d..a76d9be711 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -284,6 +284,7 @@ qemuBlockCommit(virDomainObj *vm,
                 virStorageSource *topSource,
                 virStorageSource *top_parent,
                 unsigned long bandwidth,
+                virDomainAsyncJob asyncJob,
                 unsigned int flags);
 
 int
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d8db7188f7..5ee6e2698d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15030,7 +15030,8 @@ qemuDomainBlockCommit(virDomainPtr dom,
                                                         base, disk->dst, NULL)))
         goto endjob;
 
-    ret = qemuBlockCommit(vm, disk, baseSource, topSource, top_parent, bandwidth, flags);
+    ret = qemuBlockCommit(vm, disk, baseSource, topSource, top_parent,
+                          bandwidth, VIR_ASYNC_JOB_NONE, flags);
 
  endjob:
     virDomainObjEndJob(vm);
-- 
2.38.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