render / rpms / libvirt

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