]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_monitor_json: allow configuring autofinalize for block commit
authorPavel Hrdina <phrdina@redhat.com>
Tue, 13 Dec 2022 15:40:02 +0000 (16:40 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 9 Jan 2023 12:32:44 +0000 (13:32 +0100)
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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_block.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
tests/qemumonitorjsontest.c

index 6a6836270875a6e9f4c827c96478fe1d543e4b81..99409a969b055d59aaed18a90207693fe22b87b6 100644 (file)
@@ -3364,7 +3364,8 @@ qemuBlockCommit(virDomainObj *vm,
                                  job->name,
                                  topSource->nodeformat,
                                  baseSource->nodeformat,
-                                 backingPath, bandwidth);
+                                 backingPath, bandwidth,
+                                 VIR_TRISTATE_BOOL_YES);
 
     qemuDomainObjExitMonitor(vm);
 
index 771b1b6d598827b6588d1a50b280c3031a2298cd..38f89167e05e1d2e69e07c219dca08ba29f03065 100644 (file)
@@ -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);
 }
 
 
index f51146a13a5a4c8aed674e0990624bf52a653dbe..2d16214ba21db49179c2b16b91c51d8cc6cee95b 100644 (file)
@@ -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,
index 4495f8f2cfbefc17f359c2fa326b55aff11484cb..db990175554600eeee98ecb96d58a2b13932e767 100644 (file)
@@ -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",
index d774cbaf147f7e48fe0f4b2d0d89ac0f41c5b4e9..6f376cf9b7172705f52453c5d29d6afd6934211c 100644 (file)
@@ -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
index f224ccb36463d58743c85884dfe6a3534e6e7bf3..1db1f2b949a8f9f5749e4bfcd98fd16e8c89c253 100644 (file)
@@ -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")