提交 ede3bc11 编写于 作者: D Daniel P. Berrange

Avoid creating top level cgroups if just querying for existance

When getting the driver/domain cgroup it is possible to specify
whether it should be auto created. If auto-creation was turned
off, libvirt still mistakenly created its own top level cgroup

* src/util/cgroup.c: Honour autocreate flag for top level cgroup
上级 5c0e525c
...@@ -519,7 +519,8 @@ err: ...@@ -519,7 +519,8 @@ err:
} }
static int virCgroupAppRoot(int privileged, static int virCgroupAppRoot(int privileged,
virCgroupPtr *group) virCgroupPtr *group,
int create)
{ {
virCgroupPtr rootgrp = NULL; virCgroupPtr rootgrp = NULL;
int rc; int rc;
...@@ -551,7 +552,7 @@ static int virCgroupAppRoot(int privileged, ...@@ -551,7 +552,7 @@ static int virCgroupAppRoot(int privileged,
if (rc != 0) if (rc != 0)
goto cleanup; goto cleanup;
rc = virCgroupMakeGroup(rootgrp, *group, 1); rc = virCgroupMakeGroup(rootgrp, *group, create);
cleanup: cleanup:
virCgroupFree(&rootgrp); virCgroupFree(&rootgrp);
...@@ -638,7 +639,7 @@ int virCgroupForDriver(const char *name, ...@@ -638,7 +639,7 @@ int virCgroupForDriver(const char *name,
char *path = NULL; char *path = NULL;
virCgroupPtr rootgrp = NULL; virCgroupPtr rootgrp = NULL;
rc = virCgroupAppRoot(privileged, &rootgrp); rc = virCgroupAppRoot(privileged, &rootgrp, create);
if (rc != 0) if (rc != 0)
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册