]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: monitor: Introduce qemuMonitorBitmapRemove
authorPeter Krempa <pkrempa@redhat.com>
Mon, 8 Feb 2021 15:58:53 +0000 (16:58 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Sat, 20 Feb 2021 12:21:21 +0000 (13:21 +0100)
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@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
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 151f69acef1a4922579bfdddfad4442c9b9ae884..ed35da17e18a88f24395f8eb81d32adb37babe34 100644 (file)
@@ -4653,6 +4653,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,
index 0108703a33b6035a8d8f660fce4d79d3f635bf85..d25c26343a7f5d93595170128ca2390adecbada7 100644 (file)
@@ -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,
index 3a073063652b6747dabfe0e331483aa7326c77f3..03224d4af2dbc5dd2a0ea9baf3f158cbec1acd7e 100644 (file)
@@ -9252,6 +9252,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,
index 31652d4207183ad3d9611b71354d975c9ac33785..3dd1eb24c7bce0aa1d258976c5d33a227f44067e 100644 (file)
@@ -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,
index 5a5976dbe4afc80c91d682c25915f3646efd178a..82c74e2ef9172b7240a1086d955b9f6b77e8aad8 100644 (file)
@@ -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);