We need to use the 'effective' storage nodename (one which includes the optional storage slice 'raw' intermediate layer) in the code which formats the 'format' layer props. All other cases need the real storage driver nodename as they either generate the 'storage' layer props, or the storage slice, which refers to the proper storage backend. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_block.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a98caa330e..1fc36569a9 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1060,8 +1060,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, return NULL; if (!onlytarget) { - if (qemuBlockNodeNameValidate(src->nodestorage) < 0 || - virJSONValueObjectAdd(&fileprops, "S:node-name", src->nodestorage, NULL) < 0) + if (qemuBlockNodeNameValidate(qemuBlockStorageSourceGetStorageNodename(src)) < 0 || + virJSONValueObjectAdd(&fileprops, + "S:node-name", qemuBlockStorageSourceGetStorageNodename(src), + NULL) < 0) return NULL; if (!legacy) { @@ -1358,10 +1360,6 @@ qemuBlockStorageSourceGetFormatProps(virStorageSource *src, g_autoptr(virJSONValue) props = NULL; const char *backingFormatterStr = NULL; const char *backingNodename = NULL; - const char *storagenode = src->nodestorage; - - if (qemuBlockStorageSourceNeedsStorageSliceLayer(src)) - storagenode = src->sliceStorage->nodename; if (virStorageSourceIsBacking(backingStore) && src->format < VIR_STORAGE_FILE_BACKING) { @@ -1386,7 +1384,7 @@ qemuBlockStorageSourceGetFormatProps(virStorageSource *src, return NULL; if (virJSONValueObjectAdd(&props, - "s:file", storagenode, + "s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src), backingFormatterStr, backingNodename, NULL) < 0) return 0; @@ -1408,7 +1406,7 @@ qemuBlockStorageSourceGetBlockdevStorageSliceProps(virStorageSource *src) "s:node-name", src->sliceStorage->nodename, "U:offset", src->sliceStorage->offset, "U:size", src->sliceStorage->size, - "s:file", src->nodestorage, + "s:file", qemuBlockStorageSourceGetStorageNodename(src), "b:auto-read-only", true, "s:discard", "unmap", NULL) < 0) -- 2.41.0