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