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(a)redhat.com>
Reviewed-by: Jiri Denemark <jdenemar(a)redhat.com>
---
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 151f69acef..ed35da17e1 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -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,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 0108703a33..d25c26343a 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 3a07306365..03224d4af2 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -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,
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 31652d4207..3dd1eb24c7 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 5a5976dbe4..82c74e2ef9 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