render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c313de
From 9193cc6a2395f2f26bcae2d990f78b2860b08ae9 Mon Sep 17 00:00:00 2001
c313de
Message-Id: <9193cc6a2395f2f26bcae2d990f78b2860b08ae9@dist-git>
c313de
From: Pavel Hrdina <phrdina@redhat.com>
c313de
Date: Mon, 1 Jul 2019 17:08:10 +0200
c313de
Subject: [PATCH] vircgroupv2: fix virCgroupV2ValidateMachineGroup
c313de
MIME-Version: 1.0
c313de
Content-Type: text/plain; charset=UTF-8
c313de
Content-Transfer-Encoding: 8bit
c313de
c313de
When libvirt is reconnecting to running domain that uses cgroup v2
c313de
the QEMU process reports cgroup for the emulator directory because the
c313de
main thread is in that cgroup.  We need to remove the "/emulator" part
c313de
in order to match with the root cgroup directory name for that domain.
c313de
c313de
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c313de
(cherry picked from commit 634bd528cb194439f0bea0815f579d0b0c1b1a92)
c313de
c313de
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
c313de
c313de
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c313de
Message-Id: <963bff76d79df2da95b1881fc9b7329be7b59d52.1561993100.git.phrdina@redhat.com>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
---
c313de
 src/util/vircgroupv2.c | 7 +++++++
c313de
 1 file changed, 7 insertions(+)
c313de
c313de
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
c313de
index 5652fcfffb..8658454d8b 100644
c313de
--- a/src/util/vircgroupv2.c
c313de
+++ b/src/util/vircgroupv2.c
c313de
@@ -121,6 +121,13 @@ virCgroupV2ValidateMachineGroup(virCgroupPtr group,
c313de
 
c313de
     if (!(tmp = strrchr(group->unified.placement, '/')))
c313de
         return false;
c313de
+
c313de
+    if (STREQ(tmp, "/emulator")) {
c313de
+        *tmp = '\0';
c313de
+
c313de
+        if (!(tmp = strrchr(group->unified.placement, '/')))
c313de
+            return false;
c313de
+    }
c313de
     tmp++;
c313de
 
c313de
     if (STRNEQ(tmp, partmachinename) &&
c313de
-- 
c313de
2.22.0
c313de