提交 56fdf3f0 编写于 作者: P Pavel Hrdina

vircgroupv2: store enabled controllers

In cgroups v2 when a new group is created by default no controller is
enabled so the detection code will not detect any controllers.

When enabling the controllers we should also store them for the group.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
Acked-by: NPeter Krempa <pkrempa@redhat.com>
上级 7b77f3a1
......@@ -365,7 +365,8 @@ virCgroupV2PathOfController(virCgroupPtr group,
* 0 on success
*/
static int
virCgroupV2EnableController(virCgroupPtr parent,
virCgroupV2EnableController(virCgroupPtr group,
virCgroupPtr parent,
int controller,
bool report)
{
......@@ -391,6 +392,8 @@ virCgroupV2EnableController(virCgroupPtr parent,
return -2;
}
group->unified.controllers |= 1 << controller;
return 0;
}
......@@ -432,14 +435,14 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
}
if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU) &&
virCgroupV2EnableController(parent,
virCgroupV2EnableController(group, parent,
VIR_CGROUP_CONTROLLER_CPU,
true) < 0) {
return -1;
}
if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPUSET) &&
virCgroupV2EnableController(parent,
virCgroupV2EnableController(group, parent,
VIR_CGROUP_CONTROLLER_CPUSET,
true) < 0) {
return -1;
......@@ -456,7 +459,7 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
if (i == VIR_CGROUP_CONTROLLER_CPUACCT)
continue;
rc = virCgroupV2EnableController(parent, i, false);
rc = virCgroupV2EnableController(group, parent, i, false);
if (rc < 0) {
if (rc == -2) {
virResetLastError();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册