qemuBlockReopenAccess: prepare for removal of 'raw' format layer

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>
This commit is contained in:
Peter Krempa 2023-11-22 16:58:12 +01:00
parent dee5b3fb8e
commit 9ec0e28e87

View File

@ -3202,8 +3202,19 @@ qemuBlockReopenAccess(virDomainObj *vm,
src->readonly = readonly; src->readonly = readonly;
/* from now on all error paths must use 'goto cleanup' */ /* from now on all error paths must use 'goto cleanup' */
if (!(srcprops = qemuBlockStorageSourceGetFormatProps(src, src->backingStore))) /* based on which is the current 'effecitve' layer we must reopen the
return -1; * 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) if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0)
return -1; return -1;