QEMU requires an extra wrapper object where only the "file" member is populated. This is basically a placeholder for establishing the format layer. We did the same in qemuDiskSourceGetProps for the old-school JSON usage with -drive but forgot to adopt this for -blockdev. https://bugzilla.redhat.com/show_bug.cgi?id=1804617 Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_block.c | 2 +- .../imagecreate/qcow2-backing-qcow2-slice.json | 2 +- .../qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json | 2 +- .../network-qcow2-backing-chain-cache-unsafe-srconly.json | 3 ++- .../network-qcow2-backing-chain-encryption_auth-srconly.json | 3 ++- tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json | 3 ++- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a44cfeb99c..3365ee677b 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2104,7 +2104,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src, if (!(backingJSON = virJSONValueToString(props, pretty))) return NULL; - return g_strdup_printf("json:%s", backingJSON); + return g_strdup_printf("json:{\"file\":%s}", backingJSON); } diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json index 2fa27c1933..2526740b9a 100644 --- a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json @@ -10,6 +10,6 @@ format: "driver": "qcow2", "file": "0123456789ABCDEF0123456789ABCDE", "size": 8589934590, - "backing-file": "json:{\"driver\":\"raw\",\"offset\":1234,\"size\":5768,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.qcow2\"}}", + "backing-file": "json:{\"file\":{\"driver\":\"raw\",\"offset\":1234,\"size\":5768,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.qcow2\"}}}", "backing-fmt": "qcow2" } diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json index 761002afd9..e76221da16 100644 --- a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json @@ -10,6 +10,6 @@ format: "driver": "qcow2", "file": "0123456789ABCDEF0123456789ABCDE", "size": 8589934590, - "backing-file": "json:{\"driver\":\"raw\",\"offset\":9876,\"size\":54321,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.img\"}}", + "backing-file": "json:{\"file\":{\"driver\":\"raw\",\"offset\":9876,\"size\":54321,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.img\"}}}", "backing-fmt": "raw" } diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe-srconly.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe-srconly.json index 2d7eeb3bca..0fb0b8eff9 100644 --- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe-srconly.json +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe-srconly.json @@ -16,7 +16,7 @@ ] } backing store string: - json:{ + json:{"file":{ "driver": "rbd", "pool": "rbdpool", "image": "rbdimg", @@ -31,6 +31,7 @@ } ] } + } ) ( source only properties: diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth-srconly.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth-srconly.json index 5679318fbe..777a372471 100644 --- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth-srconly.json +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth-srconly.json @@ -16,7 +16,7 @@ ] } backing store string: - json:{ + json:{"file":{ "driver": "rbd", "pool": "rbdpool", "image": "rbdimg", @@ -31,6 +31,7 @@ } ] } + } ) ( source only properties: diff --git a/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json b/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json index 970e1bb8af..26f9557c80 100644 --- a/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json +++ b/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json @@ -6,9 +6,10 @@ "namespace": 1 } backing store string: - json:{ + json:{"file":{ "driver": "nvme", "device": "0000:01:00.0", "namespace": 1 } + } ) -- 2.24.1