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