qemu: block: Always set discard for storage nodes

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>
This commit is contained in:
Peter Krempa 2018-04-19 15:44:36 +02:00
parent b51016c73c
commit 0e6b60dcac

View 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;
}