]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: block: Format 'read-only' attribute for JSON disk protocol
authorPeter Krempa <pkrempa@redhat.com>
Fri, 6 Apr 2018 04:40:23 +0000 (06:40 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 7 May 2018 13:36:41 +0000 (15:36 +0200)
This will be required when doing blockdev-add to conform with the
approach qemu choses to create the disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_block.c

index 21b88fecd6e440abaffa17269467930183f13194..775c1254671c72376885106d6993ed4edb164cac 100644 (file)
@@ -1162,6 +1162,9 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
     if (!legacy) {
         if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, fileprops) < 0)
             goto cleanup;
+
+        if (virJSONValueObjectAdd(fileprops, "b:read-only", src->readonly, NULL) < 0)
+            goto cleanup;
     }
 
     VIR_STEAL_PTR(ret, fileprops);