提交 ae515576 编写于 作者: H Hu Tao 提交者: Eric Blake

Don't return an error on failure to create blkio controller

This patch enables cgroup controllers as much as possible by skipping
the creation of blkio controller when running with old kernels that
doesn't support multi-level directory for blkio controller.
Signed-off-by: NHu Tao <hutao@cn.fujitsu.com>
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 e36804ce
......@@ -527,10 +527,21 @@ static int virCgroupMakeGroup(virCgroupPtr parent, virCgroupPtr group,
if (access(path, F_OK) != 0) {
if (!create ||
mkdir(path, 0755) < 0) {
/* With a kernel that doesn't support multi-level directory
* for blkio controller, libvirt will fail and disable all
* other controllers even though they are available. So
* treat blkio as unmounted if mkdir fails. */
if (i == VIR_CGROUP_CONTROLLER_BLKIO) {
rc = 0;
VIR_FREE(group->controllers[i].mountPoint);
VIR_FREE(path);
continue;
} else {
rc = -errno;
VIR_FREE(path);
break;
}
}
if (group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint != NULL &&
(i == VIR_CGROUP_CONTROLLER_CPUSET ||
STREQ(group->controllers[i].mountPoint, group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册