提交 2b09065e 编写于 作者: P Pavel Hrdina

vircgroup: extract virCgroupV1(Set|Get)CpusetCpus

Reviewed-by: NFabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 7f3aedac
...@@ -1768,10 +1768,7 @@ virCgroupGetCpusetMemoryMigrate(virCgroupPtr group, bool *migrate) ...@@ -1768,10 +1768,7 @@ virCgroupGetCpusetMemoryMigrate(virCgroupPtr group, bool *migrate)
int int
virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus) virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
{ {
return virCgroupSetValueStr(group, VIR_CGROUP_BACKEND_CALL(group, setCpusetCpus, -1, cpus);
VIR_CGROUP_CONTROLLER_CPUSET,
"cpuset.cpus",
cpus);
} }
...@@ -1786,10 +1783,7 @@ virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus) ...@@ -1786,10 +1783,7 @@ virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
int int
virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus) virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus)
{ {
return virCgroupGetValueStr(group, VIR_CGROUP_BACKEND_CALL(group, getCpusetCpus, -1, cpus);
VIR_CGROUP_CONTROLLER_CPUSET,
"cpuset.cpus",
cpus);
} }
......
...@@ -340,6 +340,14 @@ typedef int ...@@ -340,6 +340,14 @@ typedef int
(*virCgroupGetCpusetMemoryMigrateCB)(virCgroupPtr group, (*virCgroupGetCpusetMemoryMigrateCB)(virCgroupPtr group,
bool *migrate); bool *migrate);
typedef int
(*virCgroupSetCpusetCpusCB)(virCgroupPtr group,
const char *cpus);
typedef int
(*virCgroupGetCpusetCpusCB)(virCgroupPtr group,
char **cpus);
struct _virCgroupBackend { struct _virCgroupBackend {
virCgroupBackendType type; virCgroupBackendType type;
...@@ -414,6 +422,8 @@ struct _virCgroupBackend { ...@@ -414,6 +422,8 @@ struct _virCgroupBackend {
virCgroupGetCpusetMemsCB getCpusetMems; virCgroupGetCpusetMemsCB getCpusetMems;
virCgroupSetCpusetMemoryMigrateCB setCpusetMemoryMigrate; virCgroupSetCpusetMemoryMigrateCB setCpusetMemoryMigrate;
virCgroupGetCpusetMemoryMigrateCB getCpusetMemoryMigrate; virCgroupGetCpusetMemoryMigrateCB getCpusetMemoryMigrate;
virCgroupSetCpusetCpusCB setCpusetCpus;
virCgroupGetCpusetCpusCB getCpusetCpus;
}; };
typedef struct _virCgroupBackend virCgroupBackend; typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr; typedef virCgroupBackend *virCgroupBackendPtr;
......
...@@ -1995,6 +1995,28 @@ virCgroupV1GetCpusetMemoryMigrate(virCgroupPtr group, ...@@ -1995,6 +1995,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 = { virCgroupBackend virCgroupV1Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V1, .type = VIR_CGROUP_BACKEND_TYPE_V1,
...@@ -2067,6 +2089,8 @@ virCgroupBackend virCgroupV1Backend = { ...@@ -2067,6 +2089,8 @@ virCgroupBackend virCgroupV1Backend = {
.getCpusetMems = virCgroupV1GetCpusetMems, .getCpusetMems = virCgroupV1GetCpusetMems,
.setCpusetMemoryMigrate = virCgroupV1SetCpusetMemoryMigrate, .setCpusetMemoryMigrate = virCgroupV1SetCpusetMemoryMigrate,
.getCpusetMemoryMigrate = virCgroupV1GetCpusetMemoryMigrate, .getCpusetMemoryMigrate = virCgroupV1GetCpusetMemoryMigrate,
.setCpusetCpus = virCgroupV1SetCpusetCpus,
.getCpusetCpus = virCgroupV1GetCpusetCpus,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册