]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuBlockReopenAccess: prepare for removal of 'raw' format layer
authorPeter Krempa <pkrempa@redhat.com>
Wed, 22 Nov 2023 15:58:12 +0000 (16:58 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 27 Nov 2023 09:14:20 +0000 (10:14 +0100)
Make the helper reopening a blockdev for access pick the correct layer
to reopen based on what is currently in use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_block.c

index 2555db1778247ddab7bfd672070797d4728a0de2..8b73d93962b131d7db7117260f7d473abf459ed5 100644 (file)
@@ -3202,8 +3202,19 @@ qemuBlockReopenAccess(virDomainObj *vm,
     src->readonly = readonly;
     /* from now on all error paths must use 'goto cleanup' */
 
-    if (!(srcprops = qemuBlockStorageSourceGetFormatProps(src, src->backingStore)))
-        return -1;
+    /* based on which is the current 'effecitve' layer we must reopen the
+     * appropriate blockdev */
+    if (qemuBlockStorageSourceGetFormatNodename(src)) {
+        if (!(srcprops = qemuBlockStorageSourceGetFormatProps(src, src->backingStore)))
+            return -1;
+    } else if (qemuBlockStorageSourceGetSliceNodename(src)) {
+        if (!(srcprops = qemuBlockStorageSourceGetBlockdevStorageSliceProps(src, true)))
+            return -1;
+    } else {
+        if (!(srcprops = qemuBlockStorageSourceGetBackendProps(src,
+                                                               QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE)))
+            return -1;
+    }
 
     if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0)
         return -1;