[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH V8 4/6] add interface virCgroupGetAppRoot



On Mon, Nov 12, 2012 at 03:02:26PM +0800, Gao feng wrote:
> 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>
> ---
>  src/libvirt_private.syms |    1 +
>  src/util/cgroup.c        |   15 +++++++++++++++
>  src/util/cgroup.h        |    2 ++
>  3 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 2608072..dd7ede2 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -85,6 +85,7 @@ virCgroupDenyDeviceMajor;
>  virCgroupDenyDevicePath;
>  virCgroupForDomain;
>  virCgroupForDriver;
> +virCgroupGetAppRoot;
>  virCgroupForEmulator;
>  virCgroupForVcpu;
>  virCgroupFree;
> diff --git a/src/util/cgroup.c b/src/util/cgroup.c
> index 4aae70d..9777ad5 100644
> --- a/src/util/cgroup.c
> +++ b/src/util/cgroup.c
> @@ -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:
> diff --git a/src/util/cgroup.h b/src/util/cgroup.h
> index 0c11eb1..e26f65f 100644
> --- a/src/util/cgroup.h
> +++ b/src/util/cgroup.h
> @@ -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,
> -- 
> 1.7.7.6

I've no idea if this function will work or not, but the patch
doesn't appear to contain any problems so ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]