Pablo Greco 40546a
From 40020f9a96747e4e4b108c3cbef32222174bc2ab Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <40020f9a96747e4e4b108c3cbef32222174bc2ab@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Mon, 1 Jul 2019 17:08:13 +0200
Pablo Greco 40546a
Subject: [PATCH] util: implement virCgroupV2(Set|Get)CpusetCpus
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 3b72c84ff1c1b8b393ba9c2ccb004f8eb1ebda95)
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: <6146318ef3b9ca769029e33c4617056cdb652844.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 | 24 ++++++++++++++++++++++++
Pablo Greco 40546a
 1 file changed, 24 insertions(+)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
Pablo Greco 40546a
index bc6ced2367..ef1f286726 100644
Pablo Greco 40546a
--- a/src/util/vircgroupv2.c
Pablo Greco 40546a
+++ b/src/util/vircgroupv2.c
Pablo Greco 40546a
@@ -1601,6 +1601,28 @@ virCgroupV2GetCpusetMemoryMigrate(virCgroupPtr group ATTRIBUTE_UNUSED,
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 
Pablo Greco 40546a
+static int
Pablo Greco 40546a
+virCgroupV2SetCpusetCpus(virCgroupPtr group,
Pablo Greco 40546a
+                         const char *cpus)
Pablo Greco 40546a
+{
Pablo Greco 40546a
+    return virCgroupSetValueStr(group,
Pablo Greco 40546a
+                                VIR_CGROUP_CONTROLLER_CPUSET,
Pablo Greco 40546a
+                                "cpuset.cpus",
Pablo Greco 40546a
+                                cpus);
Pablo Greco 40546a
+}
Pablo Greco 40546a
+
Pablo Greco 40546a
+
Pablo Greco 40546a
+static int
Pablo Greco 40546a
+virCgroupV2GetCpusetCpus(virCgroupPtr group,
Pablo Greco 40546a
+                         char **cpus)
Pablo Greco 40546a
+{
Pablo Greco 40546a
+    return virCgroupGetValueStr(group,
Pablo Greco 40546a
+                                VIR_CGROUP_CONTROLLER_CPUSET,
Pablo Greco 40546a
+                                "cpuset.cpus",
Pablo Greco 40546a
+                                cpus);
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
@@ -1665,6 +1687,8 @@ virCgroupBackend virCgroupV2Backend = {
Pablo Greco 40546a
     .getCpusetMems = virCgroupV2GetCpusetMems,
Pablo Greco 40546a
     .setCpusetMemoryMigrate = virCgroupV2SetCpusetMemoryMigrate,
Pablo Greco 40546a
     .getCpusetMemoryMigrate = virCgroupV2GetCpusetMemoryMigrate,
Pablo Greco 40546a
+    .setCpusetCpus = virCgroupV2SetCpusetCpus,
Pablo Greco 40546a
+    .getCpusetCpus = virCgroupV2GetCpusetCpus,
Pablo Greco 40546a
 };
Pablo Greco 40546a
 
Pablo Greco 40546a
 
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a