Export 'qemuBlockReopenFormatMon' and use it in a new test case wich
will validate the arguments against the QMP schema.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_block.c | 2 +-
src/qemu/qemu_block.h | 5 +++++
tests/qemumonitorjsontest.c | 28 ++++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index d9b876e5c1..eedcfd927f 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3299,7 +3299,7 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc,
}
-static int
+int
qemuBlockReopenFormatMon(qemuMonitor *mon,
virStorageSource *src)
{
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index ff7048eb6c..54601a48a9 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -265,6 +265,11 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc,
GHashTable *blockNamedNodeData,
virJSONValue **actions);
+/* only for use in qemumonitorjsontest */
+int
+qemuBlockReopenFormatMon(qemuMonitor *mon,
+ virStorageSource *src);
+
int
qemuBlockReopenReadWrite(virDomainObj *vm,
virStorageSource *src,
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 0b321e8ed8..2122d9d999 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2800,6 +2800,33 @@ testQemuMonitorJSONBlockExportAdd(const void *opaque)
return 0;
}
+
+static int
+testQemuMonitorJSONBlockdevReopen(const void *opaque)
+{
+ const testGenericData *data = opaque;
+ g_autoptr(qemuMonitorTest) test = NULL;
+ g_autoptr(virStorageSource) src = virStorageSourceNew();
+
+ if (!(test = qemuMonitorTestNewSchema(data->xmlopt, data->schema)))
+ return -1;
+
+ src->format = VIR_STORAGE_FILE_QCOW2;
+ src->readonly = true;
+ src->nodeformat = g_strdup("test node");
+ src->nodestorage = g_strdup("backing nodename");
+ src->backingStore = virStorageSourceNew();
+
+ if (qemuMonitorTestAddItem(test, "blockdev-reopen",
"{\"return\":{}}") < 0)
+ return -1;
+
+ if (qemuBlockReopenFormatMon(qemuMonitorTestGetMonitor(test), src) < 0)
+ return -1;
+
+ return 0;
+}
+
+
static int
testQemuMonitorJSONqemuMonitorJSONGetCPUModelComparison(const void *opaque)
{
@@ -2997,6 +3024,7 @@ mymain(void)
DO_TEST(GetIOThreads);
DO_TEST(Transaction);
DO_TEST(BlockExportAdd);
+ DO_TEST(BlockdevReopen);
DO_TEST_SIMPLE("qmp_capabilities", qemuMonitorJSONSetCapabilities);
DO_TEST_SIMPLE("system_powerdown", qemuMonitorJSONSystemPowerdown);
DO_TEST_SIMPLE("system_reset", qemuMonitorJSONSystemReset);
--
2.31.1