I am trying to get memory stats of KVM system using libvirt (usage, free). The GetCPUStats gives the CPU usage correctly, but the memory usage is always shown as 100% for the guests. Is there any way to get memory stats for the VM on a KVM using Dom0 data.
1 Answer
I have the same question with virt-manager which always gives a value greater than 100% and this is the answers from the mailing list: https://www.redhat.com/archives/virt-tools-list/2015-November/msg00138.html
In general, the rss memory you get from libvirt contains some overhead from qemu. You should use dom.SetMemoryStatsPeriod
to make libvirt work properly.