[virt-tools-list] How to make lxc-cgroup work?

Cole Robinson crobinso at redhat.com
Wed Apr 3 22:05:13 UTC 2013


On 04/02/2013 05:44 AM, 陳韋任 (Wei-Ren Chen) wrote:
> Hi all,
> 
>   Sorry for the newbie question. But I am confused on how to make cgroup
> work on lxc. When I type `lxc-cgroup`, the command gave me the error
> below:
> 
>   $ lxc-cgroup -n ubuntu cpu.shares
>   lxc-cgroup: open /sys/fs/cgroup/cpu//lxc/ubuntu/cpu.shares : No such file or directory
>   lxc-cgroup: failed to retrieve value of 'cpu.shares' for 'ubuntu'
> 
> The articles I read mostly do this at the beginning:
> 
>   $ mkdir /cgroup
>   $ echo "cgroup  /cgroup  cgroup  defaults   0   0" >> /etc/fstab
>   $ mount cgroup
> 
> I didn't do that because it seems the system already mount cgroup on
> /sys/fs. My question is how to make lxc-cgroup work? Should I create
> ubuntu directory under /sys/fs/cgroup/cpu/lxc, then everything works?
> 

Hmm, the lxc* tools are not what virt-manager uses to manage containers, it
uses libvirt which has a separate userspace lxc implementation. Libvirt is
supposed to handle all the cgroup stuff automagically (well, at least on a
modern Fedora system it does).

>   The other question I believe most relate to the virtual machine
> manager. When I edit lxc container through the vmm, there is an CPU
> limits option. Does that option work? Because from the top or
> /proc/cpuinfo I don't see the limit I set works.
> 

Are you talking about virt-manager? There isn't UI in virt-manager for CPU
usage limits, what specifically do you mean? Number of CPUs? I don't think
libvirt's lxc impl does anything with that value, though just releases libvirt
1.0.4 appears to do something but I'm not sure what.

- Cole




More information about the virt-tools-list mailing list