提交 92741ef3 编写于 作者: W Wen Congyang 提交者: Daniel Veillard

Introduce the function virCgroupForEmulator

Introduce the function virCgroupForEmulator() to create sub directory
for simulator thread(include I/O thread, vhost-net thread)
Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
Signed-off-by: NTang Chen <tangchen@cn.fujitsu.com>
Signed-off-by: NHu Tao <hutao@cn.fujitsu.com>
上级 c18dc28b
......@@ -71,6 +71,7 @@ virCgroupDenyDeviceMajor;
virCgroupDenyDevicePath;
virCgroupForDomain;
virCgroupForDriver;
virCgroupForEmulator;
virCgroupForVcpu;
virCgroupFree;
virCgroupGetBlkioWeight;
......
......@@ -956,6 +956,48 @@ int virCgroupForVcpu(virCgroupPtr driver ATTRIBUTE_UNUSED,
}
#endif
/**
* virCgroupForEmulator:
*
* @driver: group for the domain
* @group: Pointer to returned virCgroupPtr
*
* Returns: 0 on success or -errno on failure
*/
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
int virCgroupForEmulator(virCgroupPtr driver,
virCgroupPtr *group,
int create)
{
int rc;
char *path;
if (driver == NULL)
return -EINVAL;
if (virAsprintf(&path, "%s/emulator", driver->path) < 0)
return -ENOMEM;
rc = virCgroupNew(path, group);
VIR_FREE(path);
if (rc == 0) {
rc = virCgroupMakeGroup(driver, *group, create, VIR_CGROUP_VCPU);
if (rc != 0)
virCgroupFree(group);
}
return rc;
}
#else
int virCgroupForEmulator(virCgroupPtr driver ATTRIBUTE_UNUSED,
virCgroupPtr *group ATTRIBUTE_UNUSED,
int create ATTRIBUTE_UNUSED)
{
return -ENXIO;
}
#endif
/**
* virCgroupSetBlkioWeight:
*
......
......@@ -59,6 +59,10 @@ int virCgroupForVcpu(virCgroupPtr driver,
virCgroupPtr *group,
int create);
int virCgroupForEmulator(virCgroupPtr driver,
virCgroupPtr *group,
int create);
int virCgroupPathOfController(virCgroupPtr group,
int controller,
const char *key,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册