]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBlockReopenFormatMon: Adapt to new argument format of 'blockdev-reopen'
authorPeter Krempa <pkrempa@redhat.com>
Mon, 22 Feb 2021 16:55:12 +0000 (17:55 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 26 Jul 2021 18:25:22 +0000 (20:25 +0200)
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@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_block.c

index 0015a8ee111eaf745ed154ed398c520fbb01467f..3d54901eaabeeb97b7036f757e4411e04b51b07a 100644 (file)
@@ -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)