render / rpms / libvirt

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