|
|
c480ed |
From 1f5aa6a591ba44492813f5a1a92d0fd2480ae3e7 Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <1f5aa6a591ba44492813f5a1a92d0fd2480ae3e7@dist-git>
|
|
|
c480ed |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c480ed |
Date: Mon, 1 Jul 2019 17:07:03 +0200
|
|
|
c480ed |
Subject: [PATCH] vircgroup: extract virCgroupV1(Set|Get)CpusetMems
|
|
|
c480ed |
MIME-Version: 1.0
|
|
|
c480ed |
Content-Type: text/plain; charset=UTF-8
|
|
|
c480ed |
Content-Transfer-Encoding: 8bit
|
|
|
c480ed |
|
|
|
c480ed |
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 41510b1b74b9d15a64aaefa83826ddf00c999fe0)
|
|
|
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: <163d30216cc48d77abac54b014faa779c64aa629.1561993100.git.phrdina@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/util/vircgroup.c | 10 ++--------
|
|
|
c480ed |
src/util/vircgroupbackend.h | 11 +++++++++++
|
|
|
c480ed |
src/util/vircgroupv1.c | 25 +++++++++++++++++++++++++
|
|
|
c480ed |
3 files changed, 38 insertions(+), 8 deletions(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
|
|
|
c480ed |
index 8b14c053e9..700e597157 100644
|
|
|
c480ed |
--- a/src/util/vircgroup.c
|
|
|
c480ed |
+++ b/src/util/vircgroup.c
|
|
|
c480ed |
@@ -1712,10 +1712,7 @@ virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long *kb)
|
|
|
c480ed |
int
|
|
|
c480ed |
virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
|
|
|
c480ed |
{
|
|
|
c480ed |
- return virCgroupSetValueStr(group,
|
|
|
c480ed |
- VIR_CGROUP_CONTROLLER_CPUSET,
|
|
|
c480ed |
- "cpuset.mems",
|
|
|
c480ed |
- mems);
|
|
|
c480ed |
+ VIR_CGROUP_BACKEND_CALL(group, setCpusetMems, -1, mems);
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
@@ -1730,10 +1727,7 @@ virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
|
|
|
c480ed |
int
|
|
|
c480ed |
virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
|
|
|
c480ed |
{
|
|
|
c480ed |
- return virCgroupGetValueStr(group,
|
|
|
c480ed |
- VIR_CGROUP_CONTROLLER_CPUSET,
|
|
|
c480ed |
- "cpuset.mems",
|
|
|
c480ed |
- mems);
|
|
|
c480ed |
+ VIR_CGROUP_BACKEND_CALL(group, getCpusetMems, -1, mems);
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
|
|
|
c480ed |
index 2c16706c96..35221e90df 100644
|
|
|
c480ed |
--- a/src/util/vircgroupbackend.h
|
|
|
c480ed |
+++ b/src/util/vircgroupbackend.h
|
|
|
c480ed |
@@ -324,6 +324,14 @@ typedef int
|
|
|
c480ed |
(*virCgroupGetFreezerStateCB)(virCgroupPtr group,
|
|
|
c480ed |
char **state);
|
|
|
c480ed |
|
|
|
c480ed |
+typedef int
|
|
|
c480ed |
+(*virCgroupSetCpusetMemsCB)(virCgroupPtr group,
|
|
|
c480ed |
+ const char *mems);
|
|
|
c480ed |
+
|
|
|
c480ed |
+typedef int
|
|
|
c480ed |
+(*virCgroupGetCpusetMemsCB)(virCgroupPtr group,
|
|
|
c480ed |
+ char **mems);
|
|
|
c480ed |
+
|
|
|
c480ed |
struct _virCgroupBackend {
|
|
|
c480ed |
virCgroupBackendType type;
|
|
|
c480ed |
|
|
|
c480ed |
@@ -393,6 +401,9 @@ struct _virCgroupBackend {
|
|
|
c480ed |
|
|
|
c480ed |
virCgroupSetFreezerStateCB setFreezerState;
|
|
|
c480ed |
virCgroupGetFreezerStateCB getFreezerState;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ virCgroupSetCpusetMemsCB setCpusetMems;
|
|
|
c480ed |
+ virCgroupGetCpusetMemsCB getCpusetMems;
|
|
|
c480ed |
};
|
|
|
c480ed |
typedef struct _virCgroupBackend virCgroupBackend;
|
|
|
c480ed |
typedef virCgroupBackend *virCgroupBackendPtr;
|
|
|
c480ed |
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
|
|
|
c480ed |
index 7580f8b756..be9a6b82b4 100644
|
|
|
c480ed |
--- a/src/util/vircgroupv1.c
|
|
|
c480ed |
+++ b/src/util/vircgroupv1.c
|
|
|
c480ed |
@@ -1949,6 +1949,28 @@ virCgroupV1GetFreezerState(virCgroupPtr group,
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
+static int
|
|
|
c480ed |
+virCgroupV1SetCpusetMems(virCgroupPtr group,
|
|
|
c480ed |
+ const char *mems)
|
|
|
c480ed |
+{
|
|
|
c480ed |
+ return virCgroupSetValueStr(group,
|
|
|
c480ed |
+ VIR_CGROUP_CONTROLLER_CPUSET,
|
|
|
c480ed |
+ "cpuset.mems",
|
|
|
c480ed |
+ mems);
|
|
|
c480ed |
+}
|
|
|
c480ed |
+
|
|
|
c480ed |
+
|
|
|
c480ed |
+static int
|
|
|
c480ed |
+virCgroupV1GetCpusetMems(virCgroupPtr group,
|
|
|
c480ed |
+ char **mems)
|
|
|
c480ed |
+{
|
|
|
c480ed |
+ return virCgroupGetValueStr(group,
|
|
|
c480ed |
+ VIR_CGROUP_CONTROLLER_CPUSET,
|
|
|
c480ed |
+ "cpuset.mems",
|
|
|
c480ed |
+ mems);
|
|
|
c480ed |
+}
|
|
|
c480ed |
+
|
|
|
c480ed |
+
|
|
|
c480ed |
virCgroupBackend virCgroupV1Backend = {
|
|
|
c480ed |
.type = VIR_CGROUP_BACKEND_TYPE_V1,
|
|
|
c480ed |
|
|
|
c480ed |
@@ -2016,6 +2038,9 @@ virCgroupBackend virCgroupV1Backend = {
|
|
|
c480ed |
|
|
|
c480ed |
.setFreezerState = virCgroupV1SetFreezerState,
|
|
|
c480ed |
.getFreezerState = virCgroupV1GetFreezerState,
|
|
|
c480ed |
+
|
|
|
c480ed |
+ .setCpusetMems = virCgroupV1SetCpusetMems,
|
|
|
c480ed |
+ .getCpusetMems = virCgroupV1GetCpusetMems,
|
|
|
c480ed |
};
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|