From abd1e08c422e72e4afc39ff48ae260ee8abb494a Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 22 Nov 2023 16:47:00 +0100 Subject: [PATCH] testQemuMonitorJSONBlockdevReopen: Don't use qemuBlockReopenFormatMon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the low level monitor API directly to test the QMP wrapper itself. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- tests/qemumonitorjsontest.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 6293b416bd..d9ebb429e7 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2594,6 +2594,8 @@ testQemuMonitorJSONBlockdevReopen(const void *opaque) const testGenericData *data = opaque; g_autoptr(qemuMonitorTest) test = NULL; g_autoptr(virStorageSource) src = virStorageSourceNew(); + g_autoptr(virJSONValue) reopenoptions = virJSONValueNewArray(); + g_autoptr(virJSONValue) srcprops = NULL; if (!(test = qemuMonitorTestNewSchema(data->xmlopt, data->schema))) return -1; @@ -2604,10 +2606,16 @@ testQemuMonitorJSONBlockdevReopen(const void *opaque) qemuBlockStorageSourceSetStorageNodename(src, g_strdup("backing nodename")); src->backingStore = virStorageSourceNew(); + if (!(srcprops = qemuBlockStorageSourceGetFormatProps(src, src->backingStore))) + return -1; + + if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0) + return -1; + if (qemuMonitorTestAddItem(test, "blockdev-reopen", "{\"return\":{}}") < 0) return -1; - if (qemuBlockReopenFormatMon(qemuMonitorTestGetMonitor(test), src) < 0) + if (qemuMonitorBlockdevReopen(qemuMonitorTestGetMonitor(test), &reopenoptions) < 0) return -1; return 0;