vircgroupv2: properly detect placement of running VM
vircgroupv2: properly detect placement of running VM

When libvirtd starts a VM it internally stores a path to the main
cgroup. When we restart libvirtd we should get to the same state.

When we start a VM on host with systemd the cgroup is created for us and
the process is already placed into that cgroup and we detect the path
created by systemd using /proc/$PID/cgroup. After that we create
sub-cgroups and move all threads there.

Once libvirtd is restarted we again detect the cgroup path using
/proc/$PID/cgroup, but in this case we will get a different path because
the main thread was moved to a "emulator" cgroup.

Instead of ignoring the "emulator" directory when validating cgroups
remove it completely when detecting cgroup otherwise cgroups will not
work properly when libvirtd is restarted.

Signed-off-by: Pavel Hrdina <d4772d05997b8abf035041e3b4f4996380ea7e7a@redhat.com>
Reviewed-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>

zippy2/libvirt,olafhering/libvirt,jfehlig/libvirt,crobinso/libvirt,jfehlig/libvirt,crobinso/libvirt,zippy2/libvirt,nertpinx/libvirt,libvirt/libvirt,jfehlig/libvirt,zippy2/libvirt,libvirt/libvirt,libvirt/libvirt,crobinso/libvirt,libvirt/libvirt,olafhering/libvirt,jfehlig/libvirt,zippy2/libvirt,nertpinx/libvirt,nertpinx/libvirt,olafhering/libvirt,nertpinx/libvirt,crobinso/libvirt,nertpinx/libvirt,olafhering/libvirt