'virsh dominfo <VMID>' as well as 'virsh dumpxml <VMID>' returns 0 for Total (max) and Used (current) memory. $ cat ovz.xml.4 <domain type='openvz' id='144'> <name>144</name> <vcpu>1</vcpu> <memory>524288</memory> <os> <type>exe</type> <init>/sbin/init</init> </os> <devices> <filesystem type='template'> <source name='centos-5-x86'/> <target dir='/'/> </filesystem> <interface type='bridge'> <source bridge='br0'/> </interface> </devices> </domain> $ virsh create ovz.xml.4 $ virsh dominfo 144 Id: 144 Name: 144 UUID: fb213571-5674-f9d9-f3a3-3e13d23f350b OS Type: exe State: running CPU(s): 1 CPU time: 44.5s Max memory: 0 kB Used memory: 0 kB Persistent: yes Autostart: enable $ virsh dumpxml 144 <domain type='qemu' id='144'> <name>144</name> <uuid>fb213571-5674-f9d9-f3a3-3e13d23f350b</uuid> <memory>0</memory> <currentMemory>0</currentMemory> <vcpu>1</vcpu> <os> <type>exe</type> <init>/sbin/init</init> </os> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <filesystem type='template' accessmode='passthrough'> <source name='centos-5-x86'/> <target dir='/'/> </filesystem> </devices> </domain> Generated openvz config file: ONBOOT="yes" # UBC parameters (in form of barrier:limit) KMEMSIZE="14372700:14790164" LOCKEDPAGES="2048:2048" PRIVVMPAGES="65536:69632" SHMPAGES="21504:21504" NUMPROC="240:240" PHYSPAGES="0:unlimited" VMGUARPAGES="33792:unlimited" OOMGUARPAGES="26112:unlimited" NUMTCPSOCK="360:360" NUMFLOCK="188:206" NUMPTY="16:16" NUMSIGINFO="256:256" TCPSNDBUF="1720320:2703360" TCPRCVBUF="1720320:2703360" OTHERSOCKBUF="1126080:2097152" DGRAMRCVBUF="262144:262144" NUMOTHERSOCK="360:360" DCACHESIZE="3409920:3624960" NUMFILE="9312:9312" AVNUMPROC="180:180" NUMIPTENT="128:128" # Disk quota parameters (in form of softlimit:hardlimit) DISKSPACE="1048576:1153024" DISKINODES="200000:220000" QUOTATIME="0" # CPU fair scheduler parameter CPUUNITS="1000" #UUID: fb213571-5674-f9d9-f3a3-3e13d23f350b VE_ROOT="/vz/root/$VEID" VE_PRIVATE="/vz/private/$VEID" OSTEMPLATE="centos-5-x86" ORIGIN_SAMPLE="basic" NAME="144" NETIF="ifname=br0,bridge=br0,mac=52:54:00:1B:49:2F,host_ifname=veth144.0,host_mac=52:54:00:66:E2:E8" CPUS="1" $ vzcalc -v 144 Resource Current(%) Promised(%) Max(%) Low Mem 0.29 6.16 6.16 Total RAM 0.44 n/a n/a Mem + Swap 0.14 2.02 n/a Alloc. Mem 0.23 2.52 4.81 Num. Proc 0.04 n/a 0.74 -------------------------------------------- Memory 0.44 6.16 6.16 software used: ovzkernel release is 2.6.18-194.26.1.el5.028stab081.1, vzctl-3.0.26-1, OS is CentOS 5.5, libvirt/virsh version is 0.8.8. I set a severity for that bug to 'urgent' since it makes impossible to track host resource utilization by libvirt/virsh means.
The bug is from 2011, but still not fixed, I'm also experiencing this. virsh # version Compiled against library: libvirt 1.2.6 Using library: libvirt 1.2.6 Using API: OpenVZ 1.2.6 Running hypervisor: OpenVZ 4.0.0 root@dom:~# uaname -a Linux dom 2.6.32-26-pve #1 SMP Mon Oct 14 08:22:20 CEST 2013 x86_64 GNU/Linux root@dom:~# cat /etc/debian_version 7.4
Still relevant with latest libvirt. Place to add this info is probably src/openvz/openvz_conf.c:openvzReadMemConf . The more interesting part is probably figuring out what openvz values to report, and what <memory> and <currentMemory> should be mapped to when a user manually sets them.
Thank you for reporting this issue to the libvirt project. Unfortunately we have been unable to resolve this issue due to insufficient maintainer capacity and it will now be closed. This is not a reflection on the possible validity of the issue, merely the lack of resources to investigate and address it, for which we apologise. If you none the less feel the issue is still important, you may choose to report it again at the new project issue tracker https://gitlab.com/libvirt/libvirt/-/issues The project also welcomes contribution from anyone who believes they can provide a solution.