[PATCH 3/6] qemuBlockReopenFormatMon: Adapt to new argument format of 'blockdev-reopen'

Peter Krempa pkrempa at redhat.com
Fri Jul 23 09:43:55 UTC 2021


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 <pkrempa at redhat.com>
---
 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 c96be8b52d..d9b876e5c1 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3304,8 +3304,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.31.1




More information about the libvir-list mailing list