From 634bd528cb194439f0bea0815f579d0b0c1b1a92 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Tue, 11 Dec 2018 17:35:20 +0800 Subject: [PATCH] vircgroupv2: fix virCgroupV2ValidateMachineGroup When libvirt is reconnecting to running domain that uses cgroup v2 the QEMU process reports cgroup for the emulator directory because the main thread is in that cgroup. We need to remove the "/emulator" part in order to match with the root cgroup directory name for that domain. Signed-off-by: Pavel Hrdina --- src/util/vircgroupv2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index dc2b2a65bc..81ef578549 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -120,6 +120,13 @@ virCgroupV2ValidateMachineGroup(virCgroupPtr group, if (!(tmp = strrchr(group->unified.placement, '/'))) return false; + + if (STREQ(tmp, "/emulator")) { + *tmp = '\0'; + + if (!(tmp = strrchr(group->unified.placement, '/'))) + return false; + } tmp++; if (STRNEQ(tmp, partmachinename) && -- GitLab