I am trying to limit all the memory used by virtual machines to a particular value.
On Ubuntu servers, setting limit to "libvirt-qemu " solves the issue. But in the case of CentOS, it creates libvirt/qemu/virtual-machine-name and it looks like it is not possible to set global memory limit for virtual machines; instead the only way is to change the memory of limit virtual machines created under the qemu directory.
Is it possible to set a global cgroup memory limit?
mount {
cpuset = /cgroup/cpuset;
cpu = /cgroup/cpu;
cpuacct = /cgroup/cpuacct;
memory = /cgroup/memory;
devices = /cgroup/devices;
freezer = /cgroup/freezer;
net_cls = /cgroup/net_cls;
blkio = /cgroup/blkio;
}
group mynamekvm {
perm {
admin {
uid = root;
gid = root;
}
task {
#uid of qemu and gid of kvm
uid = 107;
gid = 37;
}
}
memory {
memory.limit_in_bytes = 61G;
}
}
I have this set in cgrules.conf
qemu memory mynamekvm
and restarted cgconfig and libvirtd and restarted virtual machines,
but still
mynamekvm/memory.usage_in_bytes is 0
Any idea how to set limits in libvirt on centOS systems?