render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c480ed
From df01b3c361e5bdcd8505798336b15b862e9c6bea Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <df01b3c361e5bdcd8505798336b15b862e9c6bea@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Mon, 1 Jul 2019 17:08:11 +0200
c480ed
Subject: [PATCH] util: implement virCgroupV2(Set|Get)CpusetMems
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 74e7da060543a87610b42fc6ba26a45b0a6e3974)
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: <2bb5ec423c37893ebbf2f882da13cc4e55b23941.1561993100.git.phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/util/vircgroupv2.c | 25 +++++++++++++++++++++++++
c480ed
 1 file changed, 25 insertions(+)
c480ed
c480ed
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
c480ed
index 8658454d8b..59b8c4ad2c 100644
c480ed
--- a/src/util/vircgroupv2.c
c480ed
+++ b/src/util/vircgroupv2.c
c480ed
@@ -1562,6 +1562,28 @@ virCgroupV2GetCpuacctStat(virCgroupPtr group,
c480ed
 }
c480ed
 
c480ed
 
c480ed
+static int
c480ed
+virCgroupV2SetCpusetMems(virCgroupPtr group,
c480ed
+                         const char *mems)
c480ed
+{
c480ed
+    return virCgroupSetValueStr(group,
c480ed
+                                VIR_CGROUP_CONTROLLER_CPUSET,
c480ed
+                                "cpuset.mems",
c480ed
+                                mems);
c480ed
+}
c480ed
+
c480ed
+
c480ed
+static int
c480ed
+virCgroupV2GetCpusetMems(virCgroupPtr group,
c480ed
+                         char **mems)
c480ed
+{
c480ed
+    return virCgroupGetValueStr(group,
c480ed
+                                VIR_CGROUP_CONTROLLER_CPUSET,
c480ed
+                                "cpuset.mems",
c480ed
+                                mems);
c480ed
+}
c480ed
+
c480ed
+
c480ed
 virCgroupBackend virCgroupV2Backend = {
c480ed
     .type = VIR_CGROUP_BACKEND_TYPE_V2,
c480ed
 
c480ed
@@ -1621,6 +1643,9 @@ virCgroupBackend virCgroupV2Backend = {
c480ed
 
c480ed
     .getCpuacctUsage = virCgroupV2GetCpuacctUsage,
c480ed
     .getCpuacctStat = virCgroupV2GetCpuacctStat,
c480ed
+
c480ed
+    .setCpusetMems = virCgroupV2SetCpusetMems,
c480ed
+    .getCpusetMems = virCgroupV2GetCpusetMems,
c480ed
 };
c480ed
 
c480ed
 
c480ed
-- 
c480ed
2.22.0
c480ed