Allocated/Real Memory

Hello!
Why Allocated/Real Memory every time have the same value on KVM Hypervisor? I create VM with 16G - Real/Allocated - 16GB but in VM 65MB.

Can you check that the memory value is correct in libvirt? You can retrieve this info in KB executing this command in the hypervisor host:

# virsh -c qemu:///system dommemstat one-<vmid>

Does it happen to all the VMs or only with an specific image?

it happen to all the VMs

virsh -c qemu:///system dommemstat one-284
actual 16777216
rss 799996

OpenNebula seems to be correctly setting the memory. What’s exactly the problem? The VM can not see 16 Gb of memory? If this is the problem then there should be a problem with your VM. Maybe it’s 32 bits and you need to enable PAE.

If you expect the VM to consume only allocated memory you should look into memory balloning. OpenNebula does not support it anyway.

https://libvirt.org/formatdomain.html#elementsMemBalloon

I meant that Opennebula shows only the allocated memory is not real …

OpenNebula queries the hypervisor to check how much memory the VM is consuming. That’s the value we use as we don’t get information from the Guest OS.

Hello,
I find some sulutions about memory stat in opennebula and kvm.


http://libvir-list.redhat.narkive.com/0xg544qp/libvirt-kvm-domain-memory-and-disk-usage
https://www.redhat.com/archives/virt-tools-list/2015-November/msg00138.html

Hello UAnton, you can get real memory consumption from guest, but it is useless with default kvm driver.

By default, when you create new VM, driver sets “Max memory” and “Used memory” to same size. So Virtio Balloon have zero size. You can read more about ballooning here

For OpenNebula exist project called CloudVAMP, which I personally tested and contributed to it, but don’t use it.

I don’t use it, because of problems with monitoring linux guests and swapping. Project uses simple monitoring script, which send data about free memory via OneGate to VM User template. CloudVAMP daemon reads it and adjust “Used Memory” size on the fly. Problem is with swapping, because if VM doesn’t have enough memory, it try to swap and freeze, so no new monitoring data will be send. CloudVAMP daemon needs to implement some timeout, which will be checking for last monitored time and if there is delay it should set “Used Memory” size to “Max Memory” size. I was planning to implement this, but for now I don’t have a time and/or taste to do it.

Hello feldsam,
Thanks for unswer. I try.