render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From df01b3c361e5bdcd8505798336b15b862e9c6bea Mon Sep 17 00:00:00 2001
Message-Id: <df01b3c361e5bdcd8505798336b15b862e9c6bea@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:08:11 +0200
Subject: [PATCH] util: implement virCgroupV2(Set|Get)CpusetMems
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 74e7da060543a87610b42fc6ba26a45b0a6e3974)

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

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

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 8658454d8b..59b8c4ad2c 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -1562,6 +1562,28 @@ virCgroupV2GetCpuacctStat(virCgroupPtr group,
 }
 
 
+static int
+virCgroupV2SetCpusetMems(virCgroupPtr group,
+                         const char *mems)
+{
+    return virCgroupSetValueStr(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.mems",
+                                mems);
+}
+
+
+static int
+virCgroupV2GetCpusetMems(virCgroupPtr group,
+                         char **mems)
+{
+    return virCgroupGetValueStr(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.mems",
+                                mems);
+}
+
+
 virCgroupBackend virCgroupV2Backend = {
     .type = VIR_CGROUP_BACKEND_TYPE_V2,
 
@@ -1621,6 +1643,9 @@ virCgroupBackend virCgroupV2Backend = {
 
     .getCpuacctUsage = virCgroupV2GetCpuacctUsage,
     .getCpuacctStat = virCgroupV2GetCpuacctStat,
+
+    .setCpusetMems = virCgroupV2SetCpusetMems,
+    .getCpusetMems = virCgroupV2GetCpusetMems,
 };
 
 
-- 
2.22.0