[libvirt-users] libvirt/qemu and cgroups

Daniel P. Berrange berrange at redhat.com
Mon Feb 10 12:33:04 UTC 2014


On Mon, Feb 10, 2014 at 01:28:42PM +0100, arnaud gaboury wrote:
> > The precise answer depends on which version of systemd you have. In
> > any systemd host though, systemd should ensure all the filesystems
> > are mounted correctly. If you have libvirt >= 1.1.1 and systemd >= 205
> > then you can use its "slice" and "scope" concepts to setup grouping
> > of VMs. If you have older systemd,  then you have to setup groups
> > manually. There's some guidance on setting up groups here
> >
> >    http://libvirt.org/cgroups.html
> >
> > If you have systemd >= 205 then you can ignore cgconfig.conf entirely.
> 
> 
> systemd 208-10  and libvirt 1.2.1-1
> 
> So you are telling me I spent hours and hours of reading for nothing ? GGGrrhhh.
> 
> I use the slice concept (or partition map) with this file :
> 
> machine-dahlia.slice
> 
> I have been reading and reading again your mentioned link, and I
> think it is the correct thing to do. But this part puzzles me:
> 
> Systemd slice naming
> 
> The systemd convention for slice naming is that a slice should include
> the name of all of its parents prepended on its own name. So for a
> libvirt partition /machine/engineering/testing, the slice name will be
> machine-engineering-testing.slice. Again the slice names map directly
> to the cgroup directory names. Systemd creates three top level slices
> by default, system.slice user.slice and machine.slice. All virtual
> machines or containers created by libvirt will be associated with
> machine.slice by default.
> 
> Following above lines, I am thus not sure of the correct name of my
> .slice systemd file. When trying to avoid any issue, the guest is on
> the root of my filesystem in /dhalia. directory. This directory is
> owned by gabx:qemu (not sure it is useful, but when I created it, it
> came with these owners)

Lets say you want a 2 level hierarchy for the guest from your example
above. In the libvirt XML you would set the partition name to:

   /machine/dahlia

this corresponds to a systemd slice call  machine-dahlia.slice

If you wanted a third level you'd need to create machine-dahlia.slice
and also create machine-dahlia-foo.slice, making sure the latter had
After=machine-dahlia.slice. Then the libvirt name would be listed as
/machine/dahlia/foo

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list