]> git.ipfire.org Git - thirdparty/libvirt.git/commit
cgroup/LXC: Do not condition availability of v2 by controllers
authorEric van Blokland <mail@ericvanblokland.nl>
Sun, 23 Oct 2022 12:08:28 +0000 (14:08 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 24 Oct 2022 10:47:13 +0000 (12:47 +0200)
commita0f37232b9c4296ca16955cc625f75eb848ace39
tree0e50bbfbf44c6a6c0717b17d2787d6b5a8e5591a
parentf1d63048b76bae8d9dd5c2f693a6df64c8117538
cgroup/LXC: Do not condition availability of v2 by controllers

systemd in hybrid mode uses v1 hierarchies for controllers and v2 for
process tracking.

The LXC code uses virCgroupAddMachineProcess() to move processes into
appropriate cgroup by manipulating cgroupfs directly. (Note, despite
libvirt also supports talking to systemd directly via
org.freedesktop.machine1 API.)

If this path is taken, libvirt/lxc must convince systemd that processes
really belong to new cgroup, i.e. also the tracking v2 hierarchy must
undergo migration too.

The current check would evaluate v2 backend as unavailable with hybrid
mode (because there are no available controllers). Simplify the
condition and consider the mounted cgroup2 as sufficient to touch v2
hierarchy.

This consequently creates an issue with binding the V2 mount. In hybrid
mode the V2 filesystem may be mounted upon the V1 filesystem. By reversing
the order in which backends are mounted in virCgroupBindMount this problem
is circumvented.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/182
Signed-off-by: Eric van Blokland <mail@ericvanblokland.nl>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/vircgroup.c
src/util/vircgroupv2.c