[libvirt RFC 04/24] qemu_block: add sync option to qemuBlockCommitImpl

Pavel Hrdina posted 24 patches 3 years, 5 months ago
[libvirt RFC 04/24] qemu_block: add sync option to qemuBlockCommitImpl
Posted by Pavel Hrdina 3 years, 5 months ago
This will allow starting synchronous block commit job that will be
used by snapshot delete code.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/qemu/qemu_block.c | 6 +++++-
 src/qemu/qemu_block.h | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 902ec7b2a5..bc46966d22 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3211,6 +3211,7 @@ qemuBlockCommitImpl(virDomainObj *vm,
                     virStorageSource *topSource,
                     virStorageSource *top_parent,
                     unsigned long bandwidth,
+                    bool sync,
                     unsigned int flags)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
@@ -3338,6 +3339,9 @@ qemuBlockCommitImpl(virDomainObj *vm,
         !(backingPath = qemuBlockGetBackingStoreString(baseSource, false)))
         goto error;
 
+    if (sync)
+        qemuBlockJobSyncBegin(job);
+
     qemuDomainObjEnterMonitor(vm);
 
     rc = qemuMonitorBlockCommit(priv->mon,
@@ -3412,7 +3416,7 @@ qemuBlockCommit(virDomainObj *vm,
         return -1;
 
     return qemuBlockCommitImpl(vm, driver, disk, baseSource, topSource,
-                               top_parent, bandwidth, flags);
+                               top_parent, bandwidth, false, flags);
 }
 
 
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 35f7718697..29b5ac9ea1 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -285,6 +285,7 @@ qemuBlockCommitImpl(virDomainObj *vm,
                     virStorageSource *topSource,
                     virStorageSource *top_parent,
                     unsigned long bandwidth,
+                    bool sync,
                     unsigned int flags);
 
 int
-- 
2.37.2
Re: [libvirt RFC 04/24] qemu_block: add sync option to qemuBlockCommitImpl
Posted by Peter Krempa 3 years, 5 months ago
On Tue, Aug 23, 2022 at 18:32:07 +0200, Pavel Hrdina wrote:
> This will allow starting synchronous block commit job that will be
> used by snapshot delete code.
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  src/qemu/qemu_block.c | 6 +++++-
>  src/qemu/qemu_block.h | 1 +
>  2 files changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>