I am trying to create a VM with added persistent memory using virsh. It
fails when persistent memory namespace size is larger than available system
memory. Please see error below, prealloc=yes is set in the command line.
For dax type namespace, as I understand, prealloc should not be needed. Is
this support to add persistent memory implemented in virsh? If so, how to
set prealloc=no? Anything else needed to add in xml for persistent memory?
Thanks.
1. dax namespace (400GB) which is larger than system memory.
# ndctl create-namespace -t pmem -m devdax --align=4k -s 400G {
"dev":"namespace1.0",
"mode":"devdax",
"map":"dev",
"size":"393.75 GiB (422.78 GB)",
"uuid":"00670b70-7871-4749-a901-9184b7a388d8",
"raw_uuid":"a5a1d3f8-01e4-45a2-bad1-38fd09bf4672",
"daxregion":{
"id":1,
"size":"393.75 GiB (422.78 GB)",
"align":4096,
"devices":[
{
"chardev":"dax1.0",
"size":"393.75 GiB (422.78 GB)"
}
]
},
"numa_node":1
}
2. Relevant parts of xml
<domain type='kvm'>
<name>test</name>
<uuid>02c49a19-ce9e-4320-9a6b-1ebf0913a10e</uuid>
<maxMemory slots='16' unit='KiB'>459800576</maxMemory>
<memory unit='KiB'>65536000</memory>
<currentMemory unit='KiB'>65536000</currentMemory>
<vcpu placement='static'>4</vcpu>
<os>
:
:
<cpu mode='custom' match='exact' check='partial'>
<feature policy='require' name='hypervisor'/>
<numa>
<cell id='0' cpus='0-3' memory='65536000'
unit='KiB'/>
</numa>
</cpu>
:
:
<memory model='nvdimm'>
<source>
<path>/dev/dax1.0</path>
</source>
<target>
<size unit='GiB'>376</size>
<node>0</node>
<label>
<size unit='KiB'>128</size>
</label>
</target>
<address type='dimm' slot='0'/>
</memory>
3. Error:
# virsh start test
error: Failed to start domain test
error: internal error: qemu unexpectedly closed the monitor: ftruncate:
Invalid argument 2019-08-22T04:16:08.744402Z qemu-system-x86_64: -object
memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/dev/dax1.0,size=403726925824:
unable to map backing store for guest RAM: Cannot allocate memory
Virsh version 4.7.0, qemu version 3.0.0