Can you use CGroups inside an OpenVZ Container?

RapidWebs asked:

just a quick question, which i have had trouble finding the answer to:

The OpenVZ Authors have been contributing a large amount of code to the linux kernel, in order to get virtualization features directly inside your operating system.

One example of this is Cgroups.

anyways, my question is: does anybody know if CGroups are available, or is planned to be available, in side the container itself?

I tried to run this on one of the OpenVZ Containers, but the service will not start. I understand why: it’s likely a hardware node orientated service- seeing as how it manages aspects within the Kernel.

However, I would love to use them within the container it self as well.

I see that namespaces are working inside containers, and thought maybe it would be a good idea if CGroups could work inside the container as well.

I ask because maybe I am not running the latest kernel version required for support. or maybe I am overlooking something.


My answer:

You can use cgroups in an LXC container, as they are namespaced, but OpenVZ is very old technology and I highly doubt you will find a way to make it work. If you can, you should start converting over from OpenVZ to LXC as the former is likely to be abandoned sooner or later. It’s LXC that all those OpenVZ devs have been building.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.