[libvirt PATCH v3 07/32] qemu_monitor_json: allow configuring autofinalize for block commit

Pavel Hrdina phrdina at redhat.com
Fri Jan 6 17:51:42 UTC 2023


Deleting external snapshots will require configuring autofinalize to
synchronize the block jobs for disks withing single snapshot in order to
be able safely abort of one of the jobs fails.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_block.c        | 3 ++-
 src/qemu/qemu_monitor.c      | 9 +++++----
 src/qemu/qemu_monitor.h      | 3 ++-
 src/qemu/qemu_monitor_json.c | 4 ++--
 src/qemu/qemu_monitor_json.h | 3 ++-
 tests/qemumonitorjsontest.c  | 2 +-
 6 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 6a68362708..99409a969b 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3364,7 +3364,8 @@ qemuBlockCommit(virDomainObj *vm,
                                  job->name,
                                  topSource->nodeformat,
                                  baseSource->nodeformat,
-                                 backingPath, bandwidth);
+                                 backingPath, bandwidth,
+                                 VIR_TRISTATE_BOOL_YES);
 
     qemuDomainObjExitMonitor(vm);
 
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 771b1b6d59..38f89167e0 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2795,16 +2795,17 @@ qemuMonitorBlockCommit(qemuMonitor *mon,
                        const char *topNode,
                        const char *baseNode,
                        const char *backingName,
-                       unsigned long long bandwidth)
+                       unsigned long long bandwidth,
+                       virTristateBool autofinalize)
 {
-    VIR_DEBUG("device=%s, jobname=%s, topNode=%s, baseNode=%s, backingName=%s, bandwidth=%llu",
+    VIR_DEBUG("device=%s, jobname=%s, topNode=%s, baseNode=%s, backingName=%s, bandwidth=%llu, autofinalize=%d",
               device, NULLSTR(jobname), NULLSTR(topNode),
-              NULLSTR(baseNode), NULLSTR(backingName), bandwidth);
+              NULLSTR(baseNode), NULLSTR(backingName), bandwidth, autofinalize);
 
     QEMU_CHECK_MONITOR(mon);
 
     return qemuMonitorJSONBlockCommit(mon, device, jobname, topNode, baseNode,
-                                      backingName, bandwidth);
+                                      backingName, bandwidth, autofinalize);
 }
 
 
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index f51146a13a..2d16214ba2 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -973,7 +973,8 @@ int qemuMonitorBlockCommit(qemuMonitor *mon,
                            const char *topNode,
                            const char *baseNode,
                            const char *backingName,
-                           unsigned long long bandwidth)
+                           unsigned long long bandwidth,
+                           virTristateBool autofinalize)
     ATTRIBUTE_NONNULL(2);
 
 int qemuMonitorArbitraryCommand(qemuMonitor *mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 4495f8f2cf..db99017555 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4028,11 +4028,11 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon,
                            const char *topNode,
                            const char *baseNode,
                            const char *backingName,
-                           unsigned long long speed)
+                           unsigned long long speed,
+                           virTristateBool autofinalize)
 {
     g_autoptr(virJSONValue) cmd = NULL;
     g_autoptr(virJSONValue) reply = NULL;
-    virTristateBool autofinalize = VIR_TRISTATE_BOOL_YES;
     virTristateBool autodismiss = VIR_TRISTATE_BOOL_NO;
 
     cmd = qemuMonitorJSONMakeCommand("block-commit",
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index d774cbaf14..6f376cf9b7 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -315,7 +315,8 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon,
                            const char *topNode,
                            const char *baseNode,
                            const char *backingName,
-                           unsigned long long bandwidth)
+                           unsigned long long bandwidth,
+                           virTristateBool autofinalize)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 int
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index f224ccb364..1db1f2b949 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1211,7 +1211,7 @@ GEN_TEST_FUNC(qemuMonitorJSONRemoveNetdev, "net0")
 GEN_TEST_FUNC(qemuMonitorJSONDelDevice, "ide0")
 GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", true, "vdb", "targetnode", 1024, 1234, 31234, true, true)
 GEN_TEST_FUNC(qemuMonitorJSONBlockStream, "vdb", "jobname", "backingnode", "backingfilename", 1024)
-GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "jobname", "topnode", "basenode", "backingfilename", 1024)
+GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "jobname", "topnode", "basenode", "backingfilename", 1024, VIR_TRISTATE_BOOL_YES)
 GEN_TEST_FUNC(qemuMonitorJSONScreendump, "devicename", 1, NULL, "/foo/bar")
 GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd", false)
 GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", "export", true, "bitmap")
-- 
2.39.0



More information about the libvir-list mailing list