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 991d32f4b7..986b2d07c1 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -1313,6 +1313,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,
@@ -1360,6 +1380,9 @@ virCgroupBackend virCgroupV2Backend = {
.setMemSwapHardLimit = virCgroupV2SetMemSwapHardLimit,
.getMemSwapHardLimit = virCgroupV2GetMemSwapHardLimit,
.getMemSwapUsage = virCgroupV2GetMemSwapUsage,
+
+ .setCpuShares = virCgroupV2SetCpuShares,
+ .getCpuShares = virCgroupV2GetCpuShares,
};
--
2.17.1