[libvirt RFC 06/24] qemu_monitor: allow setting autofinalize for block commit

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

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/qemu/qemu_block.c        | 6 ++++--
 src/qemu/qemu_block.h        | 1 +
 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 +-
 7 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index bc46966d22..ce26afe611 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3212,6 +3212,7 @@ qemuBlockCommitImpl(virDomainObj *vm,
                     virStorageSource *top_parent,
                     unsigned long bandwidth,
                     bool sync,
+                    virTristateBool autofinalize,
                     unsigned int flags)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
@@ -3349,7 +3350,7 @@ qemuBlockCommitImpl(virDomainObj *vm,
                                 job->name,
                                 topSource->nodeformat,
                                 baseSource->nodeformat,
-                                backingPath, bandwidth);
+                                backingPath, bandwidth, autofinalize);
 
     qemuDomainObjExitMonitor(vm);
 
@@ -3416,7 +3417,8 @@ qemuBlockCommit(virDomainObj *vm,
         return -1;
 
     return qemuBlockCommitImpl(vm, driver, disk, baseSource, topSource,
-                               top_parent, bandwidth, false, flags);
+                               top_parent, bandwidth, false,
+                               VIR_TRISTATE_BOOL_YES, flags);
 }
 
 
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 29b5ac9ea1..85dd9c086c 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -286,6 +286,7 @@ qemuBlockCommitImpl(virDomainObj *vm,
                     virStorageSource *top_parent,
                     unsigned long bandwidth,
                     bool sync,
+                    virTristateBool autofinalize,
                     unsigned int flags);
 
 int
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 6279e75c68..670a601cd3 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 dc35aa52c3..67353241e5 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -974,7 +974,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 9d514bfacc..fe0b88e8c5 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4035,11 +4035,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 37f76bcc0c..ba7b70bd57 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -312,7 +312,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 b508f63aea..3c61b7ddf7 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1213,7 +1213,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, "/foo/bar")
 GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd", false)
 GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", "export", true, "bitmap")
-- 
2.37.2




[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