[libvirt PATCH 08/30] qemu_block: allow configuring autofinalize for block commit

Pavel Hrdina phrdina at redhat.com
Thu Dec 8 13:30:44 UTC 2022


External snapshots will use this to synchronize qemu block jobs.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 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 5600abf6aa..2abddf904f 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3198,6 +3198,10 @@ qemuBlockExportAddNBD(virDomainObj *vm,
 }
 
 
+/* The autofinalize argument controls if the qemu block job will be automatically
+ * finalized. This is used when deleting external snapshots where we need to
+ * disable automatic finalization for some use-case. The default value passed
+ * to this argument should be VIR_TRISTATE_BOOL_YES.*/
 int
 qemuBlockCommit(virDomainObj *vm,
                 virDomainDiskDef *disk,
@@ -3206,6 +3210,7 @@ qemuBlockCommit(virDomainObj *vm,
                 virStorageSource *top_parent,
                 unsigned long bandwidth,
                 virDomainAsyncJob asyncJob,
+                virTristateBool autofinalize,
                 unsigned int flags)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
@@ -3349,7 +3354,7 @@ qemuBlockCommit(virDomainObj *vm,
                                 topSource->nodeformat,
                                 baseSource->nodeformat,
                                 backingPath, bandwidth,
-                                VIR_TRISTATE_BOOL_YES);
+                                autofinalize);
 
     qemuDomainObjExitMonitor(vm);
 
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 3f2082f102..7b6aec2a7d 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -285,6 +285,7 @@ qemuBlockCommit(virDomainObj *vm,
                 virStorageSource *top_parent,
                 unsigned long bandwidth,
                 virDomainAsyncJob asyncJob,
+                virTristateBool autofinalize,
                 unsigned int flags);
 
 int
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index acd67b1f5a..12fca22616 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15031,7 +15031,8 @@ qemuDomainBlockCommit(virDomainPtr dom,
         goto endjob;
 
     ret = qemuBlockCommit(vm, disk, baseSource, topSource, top_parent,
-                          bandwidth, VIR_ASYNC_JOB_NONE, flags);
+                          bandwidth, VIR_ASYNC_JOB_NONE, VIR_TRISTATE_BOOL_YES,
+                          flags);
 
  endjob:
     virDomainObjEndJob(vm);
-- 
2.38.1



More information about the libvir-list mailing list