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