c480ed
From d27635600023556a1e1ea566f0860facdf8d69c9 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <d27635600023556a1e1ea566f0860facdf8d69c9@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Mon, 1 Jul 2019 17:07:17 +0200
c480ed
Subject: [PATCH] vircgroup: introduce virCgroupV2DetectMounts
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
(cherry picked from commit 50f61a46fcd0f25f98bb89db74bea76bca5dc4a4)
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: <050f43f97c07f9dc1c17f477c043fbe3a6759396.1561993100.git.phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/util/vircgroupv2.c | 16 ++++++++++++++++
c480ed
 1 file changed, 16 insertions(+)
c480ed
c480ed
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
c480ed
index ed87b35db7..19a9ba38f8 100644
c480ed
--- a/src/util/vircgroupv2.c
c480ed
+++ b/src/util/vircgroupv2.c
c480ed
@@ -166,6 +166,21 @@ virCgroupV2CopyPlacement(virCgroupPtr group,
c480ed
 }
c480ed
 
c480ed
 
c480ed
+static int
c480ed
+virCgroupV2DetectMounts(virCgroupPtr group,
c480ed
+                        const char *mntType,
c480ed
+                        const char *mntOpts ATTRIBUTE_UNUSED,
c480ed
+                        const char *mntDir)
c480ed
+{
c480ed
+    if (STRNEQ(mntType, "cgroup2"))
c480ed
+        return 0;
c480ed
+
c480ed
+    VIR_FREE(group->unified.mountPoint);
c480ed
+
c480ed
+    return VIR_STRDUP(group->unified.mountPoint, mntDir);
c480ed
+}
c480ed
+
c480ed
+
c480ed
 virCgroupBackend virCgroupV2Backend = {
c480ed
     .type = VIR_CGROUP_BACKEND_TYPE_V2,
c480ed
 
c480ed
@@ -173,6 +188,7 @@ virCgroupBackend virCgroupV2Backend = {
c480ed
     .validateMachineGroup = virCgroupV2ValidateMachineGroup,
c480ed
     .copyMounts = virCgroupV2CopyMounts,
c480ed
     .copyPlacement = virCgroupV2CopyPlacement,
c480ed
+    .detectMounts = virCgroupV2DetectMounts,
c480ed
 };
c480ed
 
c480ed
 
c480ed
-- 
c480ed
2.22.0
c480ed