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

Add 'controllers' arg to virCgroupNewDetect

When detecting cgroups we must honour any controllers
whitelist the driver may have.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 c101b851
......@@ -1190,7 +1190,7 @@ int virLXCProcessStart(virConnectPtr conn,
}
if (virCgroupNewDetectMachine(vm->def->name, "lxc",
vm->pid, &priv->cgroup) < 0)
vm->pid, -1, &priv->cgroup) < 0)
goto error;
if (!priv->cgroup) {
......@@ -1398,7 +1398,7 @@ virLXCProcessReconnectDomain(virDomainObjPtr vm,
goto error;
if (virCgroupNewDetectMachine(vm->def->name, "lxc",
vm->pid, &priv->cgroup) < 0)
vm->pid, -1, &priv->cgroup) < 0)
goto error;
if (!priv->cgroup) {
......
......@@ -707,6 +707,7 @@ qemuConnectCgroup(virQEMUDriverPtr driver,
if (virCgroupNewDetectMachine(vm->def->name,
"qemu",
vm->pid,
cfg->cgroupControllers,
&priv->cgroup) < 0)
goto cleanup;
......
......@@ -1406,7 +1406,7 @@ int virCgroupNewPartition(const char *path ATTRIBUTE_UNUSED,
*/
int virCgroupNewSelf(virCgroupPtr *group)
{
return virCgroupNewDetect(-1, group);
return virCgroupNewDetect(-1, -1, group);
}
......@@ -1577,12 +1577,14 @@ int virCgroupNewEmulator(virCgroupPtr domain ATTRIBUTE_UNUSED,
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
int virCgroupNewDetect(pid_t pid,
int controllers,
virCgroupPtr *group)
{
return virCgroupNew(pid, "", NULL, -1, group);
return virCgroupNew(pid, "", NULL, controllers, group);
}
#else
int virCgroupNewDetect(pid_t pid ATTRIBUTE_UNUSED,
int controllers ATTRIBUTE_UNUSED,
virCgroupPtr *group ATTRIBUTE_UNUSED)
{
virReportSystemError(ENXIO, "%s",
......@@ -1597,9 +1599,10 @@ int virCgroupNewDetect(pid_t pid ATTRIBUTE_UNUSED,
int virCgroupNewDetectMachine(const char *name,
const char *drivername,
pid_t pid,
int controllers,
virCgroupPtr *group)
{
if (virCgroupNewDetect(pid, group) < 0) {
if (virCgroupNewDetect(pid, controllers, group) < 0) {
if (virCgroupNewIgnoreError())
return 0;
return -1;
......
......@@ -76,11 +76,13 @@ int virCgroupNewEmulator(virCgroupPtr domain,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
int virCgroupNewDetect(pid_t pid,
int controllers,
virCgroupPtr *group);
int virCgroupNewDetectMachine(const char *name,
const char *drivername,
pid_t pid,
int controllers,
virCgroupPtr *group);
int virCgroupNewMachine(const char *name,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册