mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
vircgroup: extract virCgroupV1(Set|Get)CpusetMemoryMigrate
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
41510b1b74
commit
7f3aedacac
@ -1738,10 +1738,7 @@ virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
|
||||
int
|
||||
virCgroupSetCpusetMemoryMigrate(virCgroupPtr group, bool migrate)
|
||||
{
|
||||
return virCgroupSetValueStr(group,
|
||||
VIR_CGROUP_CONTROLLER_CPUSET,
|
||||
"cpuset.memory_migrate",
|
||||
migrate ? "1" : "0");
|
||||
VIR_CGROUP_BACKEND_CALL(group, setCpusetMemoryMigrate, -1, migrate);
|
||||
}
|
||||
|
||||
|
||||
@ -1756,13 +1753,7 @@ virCgroupSetCpusetMemoryMigrate(virCgroupPtr group, bool migrate)
|
||||
int
|
||||
virCgroupGetCpusetMemoryMigrate(virCgroupPtr group, bool *migrate)
|
||||
{
|
||||
unsigned long long value = 0;
|
||||
int ret = virCgroupGetValueU64(group,
|
||||
VIR_CGROUP_CONTROLLER_CPUSET,
|
||||
"cpuset.memory_migrate",
|
||||
&value);
|
||||
*migrate = !!value;
|
||||
return ret;
|
||||
VIR_CGROUP_BACKEND_CALL(group, getCpusetMemoryMigrate, -1, migrate);
|
||||
}
|
||||
|
||||
|
||||
|
@ -332,6 +332,14 @@ typedef int
|
||||
(*virCgroupGetCpusetMemsCB)(virCgroupPtr group,
|
||||
char **mems);
|
||||
|
||||
typedef int
|
||||
(*virCgroupSetCpusetMemoryMigrateCB)(virCgroupPtr group,
|
||||
bool migrate);
|
||||
|
||||
typedef int
|
||||
(*virCgroupGetCpusetMemoryMigrateCB)(virCgroupPtr group,
|
||||
bool *migrate);
|
||||
|
||||
struct _virCgroupBackend {
|
||||
virCgroupBackendType type;
|
||||
|
||||
@ -404,6 +412,8 @@ struct _virCgroupBackend {
|
||||
|
||||
virCgroupSetCpusetMemsCB setCpusetMems;
|
||||
virCgroupGetCpusetMemsCB getCpusetMems;
|
||||
virCgroupSetCpusetMemoryMigrateCB setCpusetMemoryMigrate;
|
||||
virCgroupGetCpusetMemoryMigrateCB getCpusetMemoryMigrate;
|
||||
};
|
||||
typedef struct _virCgroupBackend virCgroupBackend;
|
||||
typedef virCgroupBackend *virCgroupBackendPtr;
|
||||
|
@ -1970,6 +1970,31 @@ virCgroupV1GetCpusetMems(virCgroupPtr group,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virCgroupV1SetCpusetMemoryMigrate(virCgroupPtr group,
|
||||
bool migrate)
|
||||
{
|
||||
return virCgroupSetValueStr(group,
|
||||
VIR_CGROUP_CONTROLLER_CPUSET,
|
||||
"cpuset.memory_migrate",
|
||||
migrate ? "1" : "0");
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virCgroupV1GetCpusetMemoryMigrate(virCgroupPtr group,
|
||||
bool *migrate)
|
||||
{
|
||||
unsigned long long value = 0;
|
||||
int ret = virCgroupGetValueU64(group,
|
||||
VIR_CGROUP_CONTROLLER_CPUSET,
|
||||
"cpuset.memory_migrate",
|
||||
&value);
|
||||
*migrate = !!value;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
virCgroupBackend virCgroupV1Backend = {
|
||||
.type = VIR_CGROUP_BACKEND_TYPE_V1,
|
||||
|
||||
@ -2040,6 +2065,8 @@ virCgroupBackend virCgroupV1Backend = {
|
||||
|
||||
.setCpusetMems = virCgroupV1SetCpusetMems,
|
||||
.getCpusetMems = virCgroupV1GetCpusetMems,
|
||||
.setCpusetMemoryMigrate = virCgroupV1SetCpusetMemoryMigrate,
|
||||
.getCpusetMemoryMigrate = virCgroupV1GetCpusetMemoryMigrate,
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user