mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: Assume QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD
Introduced in QEMU's commit of v2.11.0-rc0~95^2~9 the .discard attribute of memory-backend-file is always available for all QEMU versions we support (4.2.0, currently). Therefore, we can assume the capability is always set and thus doesn't need to be checked for. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9d86ae4ca2
commit
8c0d43803b
@ -3351,17 +3351,10 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
|
||||
return -1;
|
||||
|
||||
if (!mem->nvdimmPath &&
|
||||
discard == VIR_TRISTATE_BOOL_YES) {
|
||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("this QEMU doesn't support memory discard"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectAdd(&props,
|
||||
"B:discard-data", true,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
virJSONValueObjectAdd(&props,
|
||||
"T:discard-data", discard,
|
||||
NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0)
|
||||
|
@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-fedora/.config \
|
||||
-no-acpi \
|
||||
-boot strict=on \
|
||||
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
|
||||
-object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages1G/libvirt/qemu/-1-fedora","prealloc":true,"size":1073741824,"host-nodes":[1,2,3],"policy":"bind"}' \
|
||||
-object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages1G/libvirt/qemu/-1-fedora","discard-data":false,"prealloc":true,"size":1073741824,"host-nodes":[1,2,3],"policy":"bind"}' \
|
||||
-device '{"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","slot":0}' \
|
||||
-object '{"qom-type":"memory-backend-file","id":"memdimm1","mem-path":"/var/lib/libvirt/qemu/ram/-1-fedora/dimm1","discard-data":true,"share":false,"size":536870912}' \
|
||||
-device '{"driver":"pc-dimm","node":0,"memdev":"memdimm1","id":"dimm1","slot":1}' \
|
||||
|
@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-SomeDummyHugepagesGu/.config \
|
||||
-m 1024 \
|
||||
-overcommit mem-lock=off \
|
||||
-smp 2,sockets=2,cores=1,threads=1 \
|
||||
-object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu","prealloc":true,"size":268435456}' \
|
||||
-object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu","discard-data":false,"prealloc":true,"size":268435456}' \
|
||||
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
|
||||
-object '{"qom-type":"memory-backend-file","id":"ram-node1","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu","discard-data":true,"prealloc":true,"size":805306368}' \
|
||||
-numa node,nodeid=1,cpus=1,memdev=ram-node1 \
|
||||
|
Loading…
Reference in New Issue
Block a user