diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b06a086e18..9fcbb6c413 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3085,7 +3085,10 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, if (mem->nvdimmPath) { memPath = g_strdup(mem->nvdimmPath); - prealloc = true; + /* If the NVDIMM is a real device then there's nothing to prealloc. + * If anything, we would be only wearing off the device. */ + if (!mem->nvdimmPmem) + prealloc = true; } else if (useHugepage) { if (qemuGetDomainHupageMemPath(priv->driver, def, pagesize, &memPath) < 0) return -1; diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args index cac02a6f6d..fb4ae4b518 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args @@ -20,7 +20,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -object memory-backend-ram,id=ram-node0,size=224395264 \ -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \ -object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=no,\ -prealloc=yes,size=536870912,pmem=yes \ +size=536870912,pmem=yes \ -device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \