libvirt started after cgred - cgroup not working correctly

Bug #577264 reported by edison on 2010-05-08
This bug affects 5 people
Affects Status Importance Assigned to Milestone
libvirt (Ubuntu)
Serge Hallyn

Bug Description

I enabled cgroup for libvirt by:
Create a new virt group, by adding
group virt {
        cpu {
                cpu.shares = 9216;
into /etc/cgconfig.conf. And add "root:/usr/sbin/libvirtd cpu virt/" into /etc/cgrules.conf
So, when I start libvirt-bin, libvirtd will create its own cgroup directory under /mnt/cgroup/cpu/virt/

Everything works well, except after reboot the machine.
I found libvirt doesn't create its own cgroup under /mnt/cgroup/cpu, or /mnt/cgroup/sysdefault, instead of /mnt/cgroup/cpu/virt
After some tests, the root cause is libvirtd is started earlier than cgred.
On lucid, libvirt-bin is started by upstart, while cgred is started by sys-V init script. How can I specify the dependency between the two? Apparently, libvirt-bin should be started after cgred.
Right now, I add the following hack in /etc/init/libvirt-bin.conf:
pre-start script
        mkdir -p /var/run/libvirt
        # Clean up a pidfile that might be left around
        rm -f /var/run/
        while [ 1 ]
            if [ -f /var/run/ ]
                sleep 1
end script
Then libvirt works with cgroup again.

Mathias Gug (mathiaz) on 2010-05-18
summary: - libvirt failed to start vm: internal error Unable to find cgroup for
+ libvirt started after cgred - cgroup not working correctly
Changed in libvirt (Ubuntu):
importance: Undecided → Low
Rudd-O (rudd-o) wrote :

I also need this bug fixed. If cgred is on the system, then libvirt should start *after* it.

Serge Hallyn (serge-hallyn) wrote :

Rudd-O, can you use the same workaround listed in the

This should be fixed by converting the libcgroup package to use
upstart. Can you file a bug against the libcgroup package to
do so?

Changed in libvirt (Ubuntu):
status: New → Confirmed
The Loeki (the-loeki) wrote :

For me, the workaround works.

The related bug has already been filed under #644669

Changed in libvirt (Ubuntu):
status: Confirmed → Triaged
Serge Hallyn (serge-hallyn) wrote :

Thanks for pointing that out. I'm not sure what I was originally thinking (why I needed a separate bug rather than marking this as affecting both).

Changed in libvirt (Ubuntu):
assignee: nobody → Serge Hallyn (serge-hallyn)
Serge Hallyn (serge-hallyn) wrote :

Marked this invalid since the fix will come in libcgroup (in bug 644669).

Changed in libvirt (Ubuntu):
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers