[libvirt-users] Cgroup

Daniel P. Berrange berrange at redhat.com
Mon Jan 24 11:40:33 UTC 2011


On Sun, Jan 23, 2011 at 05:38:33PM +0300, Nikita A Menkovich wrote:
> Hello,
> 
> I'm running Debian Sid with libvirt/qemu/kvm packages from experimental:
> $ qemu --version
> QEMU emulator version 0.13.0 (Debian 0.13.0+dfsg-2), Copyright (c)
> 2003-2008 Fabrice Bellard
> $ kvm --version
> QEMU emulator version 0.13.0 (qemu-kvm-0.13.0 Debian 0.13.0+dfsg-2),
> Copyright (c) 2003-2008 Fabrice Bellard
> $ libvirtd --version
> libvirtd (libvirt) 0.8.6
> 
> /etc/libvirt/qemu.conf
> cgroup_controllers = [ "cpu", "devices" ]
> cgroup_device_acl = [
>     "/dev/null", "/dev/full", "/dev/zero",
>     "/dev/random", "/dev/urandom",
>     "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
>     "/dev/rtc", "/dev/hpet", "/dev/net/tun",
> ]
> /etc/cgconfig.conf
> mount {
> 	cpu = /dev/cgroup/cpu;
> 	cpuacct = /dev/cgroup/cpuacct;
> 	devices = /dev/cgroup/devices;
> #	memory  = /dev/cgroup/memory;
> 	blkio   = /dev/cgroup/blkio;
> }
> When I'm running virsh, and want to change cpu shares I receive an error
> virsh # schedinfo --set cpu.shares=2048 test
> Scheduler      : posix
> error: internal error cannot find cgroup for domain test
> Really I didn't have any group test in
> $ ls /dev/cgroup/cpu/sysdefault/libvirt/qemu/
> cgroup.clone_children  cgroup.event_control  cgroup.procs  cpu.shares
> notify_on_release  tasks
> 
> It happens if I run libvirt as usual user, how can I grant access to
> create cgroup to ordinary user?

When run libvirt will create cgroups under whichever group it was
in when it was started. Out of the box this will only work for
libvirt run as root, because the 'sysdefault' cgroup is readonly
for non-root users. You need to configure things such that your
user login is given a dedicated cgroup + ownership on that cgroup
to let it do 'mkdir' while non-root.

Daniel




More information about the libvirt-users mailing list