]> xenbits.xensource.com Git - libvirt.git/commit
vircgroupv2: Fix VM startup when legacy cgroups are defined
authorCole Robinson <crobinso@redhat.com>
Thu, 26 Sep 2019 19:00:55 +0000 (15:00 -0400)
committerCole Robinson <crobinso@redhat.com>
Fri, 27 Sep 2019 20:45:23 +0000 (16:45 -0400)
commitb5290a6e6e3c7af47969f88693fbdc6ff331dbb3
tree93168e209994f4a6a08358d6c9d5bba5701edd5d
parent7364f00eb3801e0a662e831423829060adf00761
vircgroupv2: Fix VM startup when legacy cgroups are defined

On Fedora 31, starting a 'mock' build alters /proc/$pid/cgroup,
probably due to usage of systemd-nspawn.

Before:
$ cat /proc/self/cgroup
0::/user.slice/user-1000.slice/...

After:
$ cat /proc/self/cgroup
1:name=systemd:/
0::/user.slice/user-1000.slice/...

The cgroupv2 code mishandles that first line in the second case, which
causes VM startup to fail with: Unable to read from
'/sys/fs/cgroup/machine/cgroup.controllers': No such file or directory

The kernel docs[1] say that the cgroupv2 path will always start with
'0::', which in the code here controllers="". Only set the v2 placement
path when we see that cgroup file entry.

[1] https://www.kernel.org/doc/html/v5.3/admin-guide/cgroup-v2.html#processes

https://bugzilla.redhat.com/show_bug.cgi?id=1751120

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/util/vircgroupv2.c