]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: block: Always set discard for storage nodes
authorPeter Krempa <pkrempa@redhat.com>
Thu, 19 Apr 2018 13:44:36 +0000 (15:44 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 7 May 2018 13:36:53 +0000 (15:36 +0200)
Enabling discard for the storage node allows the format drivers to
discard snapshots and other things, while configuration of the format
layer actually decides whether to actually discard data on request from
the host.

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

index 775c1254671c72376885106d6993ed4edb164cac..3424ae5676a59974e9e924ab12295effc5f64a35 100644 (file)
@@ -1163,7 +1163,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
         if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, fileprops) < 0)
             goto cleanup;
 
-        if (virJSONValueObjectAdd(fileprops, "b:read-only", src->readonly, NULL) < 0)
+        if (virJSONValueObjectAdd(fileprops,
+                                  "b:read-only", src->readonly,
+                                  "s:discard", "unmap",
+                                  NULL) < 0)
             goto cleanup;
     }