[PATCH 09/19] qemu: monitor: Introduce qemuMonitorBitmapRemove

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

 



The non-transaction wrapper is useful for code paths which want to
delete individual bitmaps or for cleanup after a failed job where we
want to attempt to delete every bitmap individually to prevent a failure
from cleaning up the rest.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c      | 13 +++++++++++++
 src/qemu/qemu_monitor.h      |  5 +++++
 src/qemu/qemu_monitor_json.c | 24 ++++++++++++++++++++++++
 src/qemu/qemu_monitor_json.h |  6 ++++++
 tests/qemumonitorjsontest.c  |  2 ++
 5 files changed, 50 insertions(+)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 14966d4096..2fb7d6569b 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4645,6 +4645,19 @@ qemuMonitorTransactionBitmapRemove(virJSONValuePtr actions,
 }


+int
+qemuMonitorBitmapRemove(qemuMonitorPtr mon,
+                        const char *node,
+                        const char *name)
+{
+    VIR_DEBUG("node='%s', name='%s'", node, name);
+
+    QEMU_CHECK_MONITOR(mon);
+
+    return qemuMonitorJSONBitmapRemove(mon, node, name);
+}
+
+
 int
 qemuMonitorTransactionBitmapEnable(virJSONValuePtr actions,
                                    const char *node,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 7a039641ba..544611b443 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1478,6 +1478,11 @@ int
 qemuMonitorTransactionBitmapRemove(virJSONValuePtr actions,
                                    const char *node,
                                    const char *name);
+
+int
+qemuMonitorBitmapRemove(qemuMonitorPtr mon,
+                        const char *node,
+                        const char *name);
 int
 qemuMonitorTransactionBitmapEnable(virJSONValuePtr actions,
                                    const char *node,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 65c30e3bb4..f19bb589b2 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -9253,6 +9253,30 @@ qemuMonitorJSONTransactionBitmapRemove(virJSONValuePtr actions,
 }


+int
+qemuMonitorJSONBitmapRemove(qemuMonitorPtr mon,
+                            const char *node,
+                            const char *name)
+{
+    g_autoptr(virJSONValue) cmd = NULL;
+    g_autoptr(virJSONValue) reply = NULL;
+
+    if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-remove",
+                                           "s:node", node,
+                                           "s:name", name,
+                                           NULL)))
+        return -1;
+
+    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
+        return -1;
+
+    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 int
 qemuMonitorJSONTransactionBitmapEnable(virJSONValuePtr actions,
                                        const char *node,
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index ba1531fee8..8e2ab24a59 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -659,6 +659,12 @@ int
 qemuMonitorJSONTransactionBitmapRemove(virJSONValuePtr actions,
                                        const char *node,
                                        const char *name);
+
+int
+qemuMonitorJSONBitmapRemove(qemuMonitorPtr mon,
+                            const char *node,
+                            const char *name);
+
 int
 qemuMonitorJSONTransactionBitmapEnable(virJSONValuePtr actions,
                                        const char *node,
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 956423f10f..af02c0b0e6 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1215,6 +1215,7 @@ GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayOpen, "foodev", true)
 GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayClose, "foodev")
 GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumRemove, "foodev")
 GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumInsert, "foodev", "newnode")
+GEN_TEST_FUNC(qemuMonitorJSONBitmapRemove, "foodev", "newnode")
 GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname")
 GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname", false)
 GEN_TEST_FUNC(qemuMonitorJSONJobComplete, "jobname")
@@ -3132,6 +3133,7 @@ mymain(void)
     DO_TEST_GEN(qemuMonitorJSONBlockdevTrayClose);
     DO_TEST_GEN(qemuMonitorJSONBlockdevMediumRemove);
     DO_TEST_GEN(qemuMonitorJSONBlockdevMediumInsert);
+    DO_TEST_GEN(qemuMonitorJSONBitmapRemove);
     DO_TEST_GEN(qemuMonitorJSONJobDismiss);
     DO_TEST_GEN(qemuMonitorJSONJobCancel);
     DO_TEST_GEN(qemuMonitorJSONJobComplete);
-- 
2.29.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