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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
if (!(backingJSON = virJSONValueToString(props, pretty)))
return NULL;
- return g_strdup_printf("json:%s", backingJSON);
+ return g_strdup_printf("json:{\"file\":%s}", backingJSON);
}
"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"
}
"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"
}
]
}
backing store string:
- json:{
+ json:{"file":{
"driver": "rbd",
"pool": "rbdpool",
"image": "rbdimg",
}
]
}
+ }
)
(
source only properties:
]
}
backing store string:
- json:{
+ json:{"file":{
"driver": "rbd",
"pool": "rbdpool",
"image": "rbdimg",
}
]
}
+ }
)
(
source only properties:
"namespace": 1
}
backing store string:
- json:{
+ json:{"file":{
"driver": "nvme",
"device": "0000:01:00.0",
"namespace": 1
}
+ }
)