From 40020f9a96747e4e4b108c3cbef32222174bc2ab Mon Sep 17 00:00:00 2001 Message-Id: <40020f9a96747e4e4b108c3cbef32222174bc2ab@dist-git> From: Pavel Hrdina Date: Mon, 1 Jul 2019 17:08:13 +0200 Subject: [PATCH] util: implement virCgroupV2(Set|Get)CpusetCpus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Hrdina (cherry picked from commit 3b72c84ff1c1b8b393ba9c2ccb004f8eb1ebda95) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297 Signed-off-by: Pavel Hrdina Message-Id: <6146318ef3b9ca769029e33c4617056cdb652844.1561993100.git.phrdina@redhat.com> Reviewed-by: Ján Tomko --- src/util/vircgroupv2.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index bc6ced2367..ef1f286726 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -1601,6 +1601,28 @@ virCgroupV2GetCpusetMemoryMigrate(virCgroupPtr group ATTRIBUTE_UNUSED, } +static int +virCgroupV2SetCpusetCpus(virCgroupPtr group, + const char *cpus) +{ + return virCgroupSetValueStr(group, + VIR_CGROUP_CONTROLLER_CPUSET, + "cpuset.cpus", + cpus); +} + + +static int +virCgroupV2GetCpusetCpus(virCgroupPtr group, + char **cpus) +{ + return virCgroupGetValueStr(group, + VIR_CGROUP_CONTROLLER_CPUSET, + "cpuset.cpus", + cpus); +} + + virCgroupBackend virCgroupV2Backend = { .type = VIR_CGROUP_BACKEND_TYPE_V2, @@ -1665,6 +1687,8 @@ virCgroupBackend virCgroupV2Backend = { .getCpusetMems = virCgroupV2GetCpusetMems, .setCpusetMemoryMigrate = virCgroupV2SetCpusetMemoryMigrate, .getCpusetMemoryMigrate = virCgroupV2GetCpusetMemoryMigrate, + .setCpusetCpus = virCgroupV2SetCpusetCpus, + .getCpusetCpus = virCgroupV2GetCpusetCpus, }; -- 2.22.0