[libvirt] Error when creating VM with persistent memory

Michal Privoznik mprivozn at redhat.com
Mon Sep 2 06:51:13 UTC 2019


On 8/31/19 7:33 PM, Seema Pandit wrote:
> Hi Michal,
> Thank you for the reply.
> I was having issues compiling qemu code on fedora29. So instead of dropping
> prealloc in virsh, tried adding prealloc=yes in qemu command line.
> prealloc=yes works. It does not lead to using more system memory when using
> DAX.
> +Dan
> Here are the steps:
> 
> ndctl create-namespace -t pmem -m fsdax --align=4k -s 400G
> 
> mkfs.ext4 /dev/pmem0
> 
> mount -o dax /dev/pmem0 /mnt/pmem0
> 
> dd if=/dev/zero of=/mnt/pmem0/file1 bs=4k count=104857600
> 
> [root at system-name]# dd if=/dev/zero of=/mnt/pmem0/file1 bs=4k
> count=104857600
> 
> dd: error writing '/mnt/pmem0/file1': No space left on device
> 
> 101313980+0 records in
> 
> 101313979+0 records out
> 
> 414982057984 bytes (415 GB, 386 GiB) copied, 946.495 s, 438 MB/s
> 
> 
> Slightly smaller file is created than asked.
> 
> [root at system-name]# du -sh
> 
> 387G    .
> 
> 
> sample qemu command line which works:
> 
> qemu-system-x86_64 \
> 
> -name test \
> 
> -drive
> file=/var/lib/libvirt/images/test-ad.qcow2,format=qcow2,index=0,media=disk
> \ -m 2G,slots=4,maxmem=428G \ -smp 2 \ -machine pc,accel=kvm,nvdimm=on \
> -enable-kvm \ -object
> memory-backend-file,id=pmem1,prealloc=yes,share=on,mem-path=/mnt/pmem0/file1,size=386G,align=4K
> \ -device nvdimm,memdev=pmem1,id=nv1 \ -daemonize

Looks like the only difference to the cmd line generated by libvirt and 
this one then is align=4K. To confirm that, can you share the full qemu 
cmd line as generated by libvirt please?
Libvirt does not do anything special with guest memory, so this is 
matter of qemu cmd line and that's why we need to see what's different, 
what works and what doesn't. Then we have some lead to understand the 
problem IMO.

Michal




More information about the libvir-list mailing list