From c1d17ca64b2979eb04ba589604dc0fa0d138d2c0 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 22 Feb 2021 17:55:12 +0100 Subject: [PATCH] qemuBlockReopenFormatMon: Adapt to new argument format of 'blockdev-reopen' This function was added prior 'blockdev-reopen' being stable and qemu changed the arguments to actually contain an array of block node definitions to reopen. In our case we are just changing between read-only and read-write modes and thus we can keep operating on the nodes one-by-one. Modify the code to add the wrapper array. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_block.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 0015a8ee11..3d54901eaa 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -3291,8 +3291,18 @@ qemuBlockReopenFormatMon(qemuMonitor *mon, virStorageSource *src) { g_autoptr(virJSONValue) reopenprops = NULL; + g_autoptr(virJSONValue) srcprops = NULL; + g_autoptr(virJSONValue) reopenoptions = virJSONValueNewArray(); - if (!(reopenprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore))) + if (!(srcprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore))) + return -1; + + if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0) + return -1; + + if (virJSONValueObjectCreate(&reopenprops, + "a:options", &reopenoptions, + NULL) < 0) return -1; if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0) -- 2.47.2