Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/util/vircgroupv2.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 3d1d68ded5..6cecfb9741 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -1307,6 +1307,26 @@ virCgroupV2GetMemSwapUsage(virCgroupPtr group,
}
+static int
+virCgroupV2SetCpuShares(virCgroupPtr group,
+ unsigned long long shares)
+{
+ return virCgroupSetValueU64(group,
+ VIR_CGROUP_CONTROLLER_CPU,
+ "cpu.weight", shares);
+}
+
+
+static int
+virCgroupV2GetCpuShares(virCgroupPtr group,
+ unsigned long long *shares)
+{
+ return virCgroupGetValueU64(group,
+ VIR_CGROUP_CONTROLLER_CPU,
+ "cpu.weight", shares);
+}
+
+
virCgroupBackend virCgroupV2Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V2,
@@ -1354,6 +1374,9 @@ virCgroupBackend virCgroupV2Backend = {
.setMemSwapHardLimit = virCgroupV2SetMemSwapHardLimit,
.getMemSwapHardLimit = virCgroupV2GetMemSwapHardLimit,
.getMemSwapUsage = virCgroupV2GetMemSwapUsage,
+
+ .setCpuShares = virCgroupV2SetCpuShares,
+ .getCpuShares = virCgroupV2GetCpuShares,
};
--
2.17.1