render / rpms / libvirt

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