|
Pablo Greco |
40546a |
From d45a116567b6ad1cc87060651a4d1c8d83384ba8 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <d45a116567b6ad1cc87060651a4d1c8d83384ba8@dist-git>
|
|
Pablo Greco |
40546a |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Mon, 1 Jul 2019 17:07:05 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] vircgroup: extract virCgroupV1(Set|Get)CpusetCpus
|
|
Pablo Greco |
40546a |
MIME-Version: 1.0
|
|
Pablo Greco |
40546a |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
40546a |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit 2b09065e0fb4b40e05a46f0592d978d3cb72278f)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <e68c2c6509b0e9e76c923c980f2d73f0a756cfd1.1561993100.git.phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/util/vircgroup.c | 10 ++--------
|
|
Pablo Greco |
40546a |
src/util/vircgroupbackend.h | 10 ++++++++++
|
|
Pablo Greco |
40546a |
src/util/vircgroupv1.c | 24 ++++++++++++++++++++++++
|
|
Pablo Greco |
40546a |
3 files changed, 36 insertions(+), 8 deletions(-)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
index 1a5ed472df..b159bda1bb 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
@@ -1772,10 +1772,7 @@ virCgroupGetCpusetMemoryMigrate(virCgroupPtr group, bool *migrate)
|
|
Pablo Greco |
40546a |
int
|
|
Pablo Greco |
40546a |
virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
|
|
Pablo Greco |
40546a |
{
|
|
Pablo Greco |
40546a |
- return virCgroupSetValueStr(group,
|
|
Pablo Greco |
40546a |
- VIR_CGROUP_CONTROLLER_CPUSET,
|
|
Pablo Greco |
40546a |
- "cpuset.cpus",
|
|
Pablo Greco |
40546a |
- cpus);
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_BACKEND_CALL(group, setCpusetCpus, -1, cpus);
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -1790,10 +1787,7 @@ virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
|
|
Pablo Greco |
40546a |
int
|
|
Pablo Greco |
40546a |
virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus)
|
|
Pablo Greco |
40546a |
{
|
|
Pablo Greco |
40546a |
- return virCgroupGetValueStr(group,
|
|
Pablo Greco |
40546a |
- VIR_CGROUP_CONTROLLER_CPUSET,
|
|
Pablo Greco |
40546a |
- "cpuset.cpus",
|
|
Pablo Greco |
40546a |
- cpus);
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_BACKEND_CALL(group, getCpusetCpus, -1, cpus);
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
|
|
Pablo Greco |
40546a |
index d4e4c4a6cc..1c5744ef76 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroupbackend.h
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroupbackend.h
|
|
Pablo Greco |
40546a |
@@ -340,6 +340,14 @@ typedef int
|
|
Pablo Greco |
40546a |
(*virCgroupGetCpusetMemoryMigrateCB)(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
bool *migrate);
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+typedef int
|
|
Pablo Greco |
40546a |
+(*virCgroupSetCpusetCpusCB)(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ const char *cpus);
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+typedef int
|
|
Pablo Greco |
40546a |
+(*virCgroupGetCpusetCpusCB)(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ char **cpus);
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
struct _virCgroupBackend {
|
|
Pablo Greco |
40546a |
virCgroupBackendType type;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -414,6 +422,8 @@ struct _virCgroupBackend {
|
|
Pablo Greco |
40546a |
virCgroupGetCpusetMemsCB getCpusetMems;
|
|
Pablo Greco |
40546a |
virCgroupSetCpusetMemoryMigrateCB setCpusetMemoryMigrate;
|
|
Pablo Greco |
40546a |
virCgroupGetCpusetMemoryMigrateCB getCpusetMemoryMigrate;
|
|
Pablo Greco |
40546a |
+ virCgroupSetCpusetCpusCB setCpusetCpus;
|
|
Pablo Greco |
40546a |
+ virCgroupGetCpusetCpusCB getCpusetCpus;
|
|
Pablo Greco |
40546a |
};
|
|
Pablo Greco |
40546a |
typedef struct _virCgroupBackend virCgroupBackend;
|
|
Pablo Greco |
40546a |
typedef virCgroupBackend *virCgroupBackendPtr;
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
|
|
Pablo Greco |
40546a |
index 3a41899dd8..54e7d6ea9a 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroupv1.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroupv1.c
|
|
Pablo Greco |
40546a |
@@ -1996,6 +1996,28 @@ virCgroupV1GetCpusetMemoryMigrate(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+static int
|
|
Pablo Greco |
40546a |
+virCgroupV1SetCpusetCpus(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ const char *cpus)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ return virCgroupSetValueStr(group,
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_CONTROLLER_CPUSET,
|
|
Pablo Greco |
40546a |
+ "cpuset.cpus",
|
|
Pablo Greco |
40546a |
+ cpus);
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+static int
|
|
Pablo Greco |
40546a |
+virCgroupV1GetCpusetCpus(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ char **cpus)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ return virCgroupGetValueStr(group,
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_CONTROLLER_CPUSET,
|
|
Pablo Greco |
40546a |
+ "cpuset.cpus",
|
|
Pablo Greco |
40546a |
+ cpus);
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
virCgroupBackend virCgroupV1Backend = {
|
|
Pablo Greco |
40546a |
.type = VIR_CGROUP_BACKEND_TYPE_V1,
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -2068,6 +2090,8 @@ virCgroupBackend virCgroupV1Backend = {
|
|
Pablo Greco |
40546a |
.getCpusetMems = virCgroupV1GetCpusetMems,
|
|
Pablo Greco |
40546a |
.setCpusetMemoryMigrate = virCgroupV1SetCpusetMemoryMigrate,
|
|
Pablo Greco |
40546a |
.getCpusetMemoryMigrate = virCgroupV1GetCpusetMemoryMigrate,
|
|
Pablo Greco |
40546a |
+ .setCpusetCpus = virCgroupV1SetCpusetCpus,
|
|
Pablo Greco |
40546a |
+ .getCpusetCpus = virCgroupV1GetCpusetCpus,
|
|
Pablo Greco |
40546a |
};
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|