On Tue, Sep 18, 2018 at 5:46 PM, Pavel Hrdina <phrdina@xxxxxxxxxx> wrote:
Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
Reviewed-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
src/util/vircgroup.c | 10 ++--------
src/util/vircgroupbackend.h | 10 ++++++++++
src/util/vircgroupv1.c | 24 ++++++++++++++++++++++++
3 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index c37ada7c26..b61c6bf2f3 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1774,10 +1774,7 @@ virCgroupGetCpusetMemoryMigrate(virCgroupPtr group, bool *migrate)
int
virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
{
- return virCgroupSetValueStr(group,
- VIR_CGROUP_CONTROLLER_CPUSET,
- "cpuset.cpus",
- cpus);
+ VIR_CGROUP_BACKEND_CALL(group, setCpusetCpus, -1, cpus);
}
@@ -1792,10 +1789,7 @@ virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
int
virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus)
{
- return virCgroupGetValueStr(group,
- VIR_CGROUP_CONTROLLER_CPUSET,
- "cpuset.cpus",
- cpus);
+ VIR_CGROUP_BACKEND_CALL(group, getCpusetCpus, -1, cpus);
}
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
index 887a508a15..fc7745d714 100644
--- a/src/util/vircgroupbackend.h
+++ b/src/util/vircgroupbackend.h
@@ -332,6 +332,14 @@ typedef int
(*virCgroupGetCpusetMemoryMigrateCB)(virCgroupPtr group,
bool *migrate);
+typedef int
+(*virCgroupSetCpusetCpusCB)(virCgroupPtr group,
+ const char *cpus);
+
+typedef int
+(*virCgroupGetCpusetCpusCB)(virCgroupPtr group,
+ char **cpus);
+
struct _virCgroupBackend {
virCgroupBackendType type;
@@ -406,6 +414,8 @@ struct _virCgroupBackend {
virCgroupGetCpusetMemsCB getCpusetMems;
virCgroupSetCpusetMemoryMigrat eCB setCpusetMemoryMigrate;
virCgroupGetCpusetMemoryMigrat eCB getCpusetMemoryMigrate;
+ virCgroupSetCpusetCpusCB setCpusetCpus;
+ virCgroupGetCpusetCpusCB getCpusetCpus;
};
typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr;
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index 8070aede3e..be0be0f582 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -1990,6 +1990,28 @@ virCgroupV1GetCpusetMemoryMigrate(virCgroupPtr group,
}
+static int
+virCgroupV1SetCpusetCpus(virCgroupPtr group,
+ const char *cpus)
+{
+ return virCgroupSetValueStr(group,
+ VIR_CGROUP_CONTROLLER_CPUSET,
+ "cpuset.cpus",
+ cpus);
+}
+
+
+static int
+virCgroupV1GetCpusetCpus(virCgroupPtr group,
+ char **cpus)
+{
+ return virCgroupGetValueStr(group,
+ VIR_CGROUP_CONTROLLER_CPUSET,
+ "cpuset.cpus",
+ cpus);
+}
+
+
virCgroupBackend virCgroupV1Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V1,
@@ -2062,6 +2084,8 @@ virCgroupBackend virCgroupV1Backend = {
.getCpusetMems = virCgroupV1GetCpusetMems,
.setCpusetMemoryMigrate = virCgroupV1SetCpusetMemoryMigrate,
.getCpusetMemoryMigrate = virCgroupV1GetCpusetMemoryMigrate,
+ .setCpusetCpus = virCgroupV1SetCpusetCpus,
+ .getCpusetCpus = virCgroupV1GetCpusetCpus,
};
--
2.17.1
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list