]> xenbits.xensource.com Git - libvirt.git/commitdiff
vircgroupv2: fix virCgroupV2ValidateMachineGroup
authorPavel Hrdina <phrdina@redhat.com>
Tue, 11 Dec 2018 09:35:20 +0000 (17:35 +0800)
committerPavel Hrdina <phrdina@redhat.com>
Fri, 14 Dec 2018 03:30:20 +0000 (11:30 +0800)
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 <phrdina@redhat.com>
src/util/vircgroupv2.c

index dc2b2a65bcbb4987b52ce82df98a0f0e6ec7b0b5..81ef578549579ad530e685c1e7b57499f51ce781 100644 (file)
@@ -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) &&