add interface virCgroupGetAppRoot

because libvirt_lxc's cgroup mountpoint is what it shown
in /proc/self/cgroup.

we can get container's cgroup through virCgroupNew("/", &group),
add interface virCgroupGetAppRoot to help container to
get it's cgroup.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
This commit is contained in:
Gao feng 2012-11-12 15:02:26 +08:00 committed by Daniel P. Berrange
parent 4d4f371e09
commit 729acc23df
3 changed files with 18 additions and 0 deletions

View File

@ -85,6 +85,7 @@ virCgroupDenyDeviceMajor;
virCgroupDenyDevicePath;
virCgroupForDomain;
virCgroupForDriver;
virCgroupGetAppRoot;
virCgroupForEmulator;
virCgroupForVcpu;
virCgroupFree;

View File

@ -965,6 +965,21 @@ int virCgroupForDriver(const char *name ATTRIBUTE_UNUSED,
}
#endif
/**
* virCgroupGetAppRoot:
*
* @group: Pointer to returned virCgroupPtr
*
* Returns 0 on success
*/
int virCgroupGetAppRoot(virCgroupPtr *group)
{
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
return virCgroupNew("/", group);
#else
return -ENXIO;
#endif
}
/**
* virCgroupForDomain:

View File

@ -47,6 +47,8 @@ int virCgroupForDriver(const char *name,
int privileged,
int create);
int virCgroupGetAppRoot(virCgroupPtr *group);
int virCgroupForDomain(virCgroupPtr driver,
const char *name,
virCgroupPtr *group,