Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/util/vircgroup.c | 10 ++--------
src/util/vircgroupbackend.h | 11 +++++++++++
src/util/vircgroupv1.c | 25 +++++++++++++++++++++++++
3 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 8744cd067d..1e19813cb3 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1714,10 +1714,7 @@ virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long *kb)
int
virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
{
- return virCgroupSetValueStr(group,
- VIR_CGROUP_CONTROLLER_CPUSET,
- "cpuset.mems",
- mems);
+ VIR_CGROUP_BACKEND_CALL(group, setCpusetMems, -1, mems);
}
@@ -1732,10 +1729,7 @@ virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
int
virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
{
- return virCgroupGetValueStr(group,
- VIR_CGROUP_CONTROLLER_CPUSET,
- "cpuset.mems",
- mems);
+ VIR_CGROUP_BACKEND_CALL(group, getCpusetMems, -1, mems);
}
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
index 0369b48f2b..86fe8ce2db 100644
--- a/src/util/vircgroupbackend.h
+++ b/src/util/vircgroupbackend.h
@@ -316,6 +316,14 @@ typedef int
(*virCgroupGetFreezerStateCB)(virCgroupPtr group,
char **state);
+typedef int
+(*virCgroupSetCpusetMemsCB)(virCgroupPtr group,
+ const char *mems);
+
+typedef int
+(*virCgroupGetCpusetMemsCB)(virCgroupPtr group,
+ char **mems);
+
struct _virCgroupBackend {
virCgroupBackendType type;
@@ -385,6 +393,9 @@ struct _virCgroupBackend {
virCgroupSetFreezerStateCB setFreezerState;
virCgroupGetFreezerStateCB getFreezerState;
+
+ virCgroupSetCpusetMemsCB setCpusetMems;
+ virCgroupGetCpusetMemsCB getCpusetMems;
};
typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr;
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index a1b2f3eb23..aff1706c5b 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -1943,6 +1943,28 @@ virCgroupV1GetFreezerState(virCgroupPtr group,
}
+static int
+virCgroupV1SetCpusetMems(virCgroupPtr group,
+ const char *mems)
+{
+ return virCgroupSetValueStr(group,
+ VIR_CGROUP_CONTROLLER_CPUSET,
+ "cpuset.mems",
+ mems);
+}
+
+
+static int
+virCgroupV1GetCpusetMems(virCgroupPtr group,
+ char **mems)
+{
+ return virCgroupGetValueStr(group,
+ VIR_CGROUP_CONTROLLER_CPUSET,
+ "cpuset.mems",
+ mems);
+}
+
+
virCgroupBackend virCgroupV1Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V1,
@@ -2010,6 +2032,9 @@ virCgroupBackend virCgroupV1Backend = {
.setFreezerState = virCgroupV1SetFreezerState,
.getFreezerState = virCgroupV1GetFreezerState,
+
+ .setCpusetMems = virCgroupV1SetCpusetMems,
+ .getCpusetMems = virCgroupV1GetCpusetMems,
};
--
2.17.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list