render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From d27635600023556a1e1ea566f0860facdf8d69c9 Mon Sep 17 00:00:00 2001
Message-Id: <d27635600023556a1e1ea566f0860facdf8d69c9@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:07:17 +0200
Subject: [PATCH] vircgroup: introduce virCgroupV2DetectMounts
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 50f61a46fcd0f25f98bb89db74bea76bca5dc4a4)

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <050f43f97c07f9dc1c17f477c043fbe3a6759396.1561993100.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/util/vircgroupv2.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index ed87b35db7..19a9ba38f8 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -166,6 +166,21 @@ virCgroupV2CopyPlacement(virCgroupPtr group,
 }
 
 
+static int
+virCgroupV2DetectMounts(virCgroupPtr group,
+                        const char *mntType,
+                        const char *mntOpts ATTRIBUTE_UNUSED,
+                        const char *mntDir)
+{
+    if (STRNEQ(mntType, "cgroup2"))
+        return 0;
+
+    VIR_FREE(group->unified.mountPoint);
+
+    return VIR_STRDUP(group->unified.mountPoint, mntDir);
+}
+
+
 virCgroupBackend virCgroupV2Backend = {
     .type = VIR_CGROUP_BACKEND_TYPE_V2,
 
@@ -173,6 +188,7 @@ virCgroupBackend virCgroupV2Backend = {
     .validateMachineGroup = virCgroupV2ValidateMachineGroup,
     .copyMounts = virCgroupV2CopyMounts,
     .copyPlacement = virCgroupV2CopyPlacement,
+    .detectMounts = virCgroupV2DetectMounts,
 };
 
 
-- 
2.22.0