libvirt/SOURCES/libvirt-vircgroupv2-fix-vir...

48 lines
1.6 KiB
Diff

From 9193cc6a2395f2f26bcae2d990f78b2860b08ae9 Mon Sep 17 00:00:00 2001
Message-Id: <9193cc6a2395f2f26bcae2d990f78b2860b08ae9@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:08:10 +0200
Subject: [PATCH] vircgroupv2: fix virCgroupV2ValidateMachineGroup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
(cherry picked from commit 634bd528cb194439f0bea0815f579d0b0c1b1a92)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <963bff76d79df2da95b1881fc9b7329be7b59d52.1561993100.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/util/vircgroupv2.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 5652fcfffb..8658454d8b 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -121,6 +121,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) &&
--
2.22.0