Hi all
Has anyone seen this issue? We're running containers under CentOS
7.2
and some of these containers are reporting incorrect memory allocation
in /proc/meminfo. The output below comes from a system with 32G of
memory and 84GB of swap. The values reported are completely wrong.
yes, it's
occured time to time on our installations.
Centos 7.2 + libvirt 1.2.18 and probably on 1.3.2
We have workaround for fix it without reboot LXC container.
1) check that on HW node exists cgroups memory for container.
[root@node]# cat
/sys/fs/cgroup/memory/machine.slice/machine-lxc\\x2dpuppet.infra.scope/memory.limit_in_bytes
17179869184
[root@node]# cat
/sys/fs/cgroup/memory/machine.slice/machine-lxc\\x2dpuppet.infra.scope/memory.memsw.limit_in_bytes
18203869184
In our case limit exists and set to 16Gb mem and 16+1 Gb for mem +swap
Contaner name puppet.infra, substitute here your container name.
2) if exists - simple attach cgroups to libvirt_lxc pid :
node# yum install libcgroup-tools
node# cgclassify -g
memory:machine.slice/machine-lxc\\x2dLXC_CONTAINER_NAME.scope PID
where pid in my case found as:
[root@node]# ps ax | grep libvirt_lxc | grep -v grep | grep puppet
22254 ? Sl 296:25 /usr/libexec/libvirt_lxc --name
puppet.infra --console 24 --security=none --handshake 42 --veth
macvlan0 --veth macvlan1
After run cgclassify /proc/memory inside container show normal values
In some casees, on combination old libvirt 1.2.xx and old systemd in
some conditions (after systemctl restart libvirtd or daemon-reload)
we get same error.
But in such case we need first create/restore cgroups on node and
after this cgclassify process to groups.
For example:
make dir
# mkdir "/sys/fs/cgroup/memory/machine.slice/machine-lxc\x2dpuppet.scope"
set limit:
[root@]# echo 8589934592 >
/sys/fs/cgroup/memory/machine.slice/machine-lxc\\x2dpuppet.scope/memory.limit_in_bytes
[root@]# echo 9663676416 >
/sys/fs/cgroup/memory/machine.slice/machine-lxc\\x2dpuppet.scope/memory.memsw.limit_in_bytes
classify:
#cgclassify -g memory:machine.slice/machine-lxc\\x2dpuppet.scope
PID_LIBVIRT_LXC
p.s.
use libvirt 1.3.2, it's more stable and never show negative values
for memory and swap inside container
b.r.
Maxim Kozin