cgroup: unavailable controller prevents controller disabling
cgroup: unavailable controller prevents controller disabling

The cgroup controller filtering in virCgroupDetect does not work
properly if the following conditions are met:
1) the host system does not have a cgroup controller which
libvirt requests (unavailable controller) and
2) libvirt is configured to disable a controller (disabled controller) and
3) the disabled controller is located before the unavailable controller
in virCgroupController.

As an example: The memory controller is unavailable and the cpuset
controller is configured to be disabled.
In this scenario trying to start a domain results in the error
error: Controller 'cpuset' is not wanted, but 'memory' is co-mounted: Invalid argument

This error occurs when virCgroupDetect is called with a valid parent group.
The resulting group created by virCgroupCopyMounts holds for cpuset and
memory controller empty mount points. The filtering of disabled controllers
checks for co-mounts by comparing the mount points. The cpuset controller
causes the filtering to occur before the memory controller is marked as to be
ignored by modifying the controller mask since it is unavailable.
Therefore the co-mount detection logic compares the cpuset and memory controller
mount points and since both are empty the memory controller is regarded
erroneously as being co-mounted.

Signed-off-by: Boris Fiuczynski <2648abdd55bfebf313fd324b464b047e6eea300e@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <7bafc8cd4e6394916d396e4f8cde69753be8d066@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <40545c009452f40d2ae0bbfbd987b332d274d328@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>

eskultety/libvirt,olafhering/libvirt,datto/libvirt,libvirt/libvirt,jfehlig/libvirt,jfehlig/libvirt,eskultety/libvirt,libvirt/libvirt,nertpinx/libvirt,libvirt/libvirt,andreabolognani/libvirt,nertpinx/libvirt,taget/libvirt,datto/libvirt,VenkatDatta/libvirt,olafhering/libvirt,fabianfreyer/libvirt,olafhering/libvirt,zippy2/libvirt,andreabolognani/libvirt,taget/libvirt,andreabolognani/libvirt,zippy2/libvirt,crobinso/libvirt,zippy2/libvirt,eskultety/libvirt,jardasgit/libvirt,zippy2/libvirt,VenkatDatta/libvirt,VenkatDatta/libvirt,crobinso/libvirt,datto/libvirt,libvirt/libvirt,taget/libvirt,jfehlig/libvirt,jardasgit/libvirt,andreabolognani/libvirt,jardasgit/libvirt,andreabolognani/libvirt,datto/libvirt,jardasgit/libvirt,datto/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,jardasgit/libvirt,fabianfreyer/libvirt,VenkatDatta/libvirt,VenkatDatta/libvirt,fabianfreyer/libvirt,crobinso/libvirt,taget/libvirt,eskultety/libvirt,crobinso/libvirt,nertpinx/libvirt,eskultety/libvirt,olafhering/libvirt,jfehlig/libvirt,taget/libvirt,nertpinx/libvirt,fabianfreyer/libvirt