libvirt started after cgred - cgroup not working correctly

Bug #577264 reported by edison
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
libvirt (Ubuntu)
Invalid
Low
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/libvirtd.pid
        while [ 1 ]
        do
            if [ -f /var/run/cgred.pid ]
            then
                break
            else
                sleep 1
            fi
        done
end script
Then libvirt works with cgroup again.

Mathias Gug (mathiaz)
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
Revision history for this message
Rudd-O (rudd-o) wrote :

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

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

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

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
Revision history for this message
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
Revision history for this message
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)
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.