[prev in list] [next in list] [prev in thread] [next in thread]
List: lxc-devel
Subject: Re: [lxc-devel] [PATCH] Ignore trailing /init.scope in init cgroups
From: Stéphane Graber <stgraber () ubuntu ! com>
Date: 2015-10-29 21:51:31
Message-ID: 20151029215131.GE1946805 () dakara
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
On Thu, Oct 15, 2015 at 06:56:17PM +0000, Serge Hallyn wrote:
> The lxc monitor does not store the container's cgroups, rather it
> recalculates them whenever needed.
>
> Systemd moves itself into a /init.scope cgroup for the systemd
> controller.
>
> It might be worth changing that (by storing all cgroup info in the
> lxc_handler), but for now go the hacky route and chop off any
> trailing /init.scope.
>
> I definately thinkg we want to switch to storing as that will be
> more bullet-proof, but for now we need a quick backportable fix
> for systemd 226 guests.
>
> Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
> ---
> src/lxc/cgfs.c | 1 +
> src/lxc/cgmanager.c | 1 +
> src/lxc/cgroup.c | 14 ++++++++++++++
> src/lxc/cgroup.h | 2 ++
> 4 files changed, 18 insertions(+)
>
> diff --git a/src/lxc/cgfs.c b/src/lxc/cgfs.c
> index df2e6b2..d65f2d7 100644
> --- a/src/lxc/cgfs.c
> +++ b/src/lxc/cgfs.c
> @@ -1220,6 +1220,7 @@ static char *lxc_cgroup_get_hierarchy_path_data(const char *subsystem, struct cg
> info = find_info_for_subsystem(info, subsystem);
> if (!info)
> return NULL;
> + prune_init_scope(info->cgroup_path);
> return info->cgroup_path;
> }
>
> diff --git a/src/lxc/cgmanager.c b/src/lxc/cgmanager.c
> index a677c22..f868903 100644
> --- a/src/lxc/cgmanager.c
> +++ b/src/lxc/cgmanager.c
> @@ -776,6 +776,7 @@ static char *try_get_abs_cgroup(const char *name, const char *lxcpath,
> nerr = nih_error_get();
> nih_free(nerr);
> }
> + prune_init_scope(cgroup);
> return cgroup;
> }
>
> diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
> index 2362ad8..b1c764f 100644
> --- a/src/lxc/cgroup.c
> +++ b/src/lxc/cgroup.c
> @@ -194,3 +194,17 @@ cgroup_driver_t cgroup_driver(void)
> {
> return ops->driver;
> }
> +
> +#define INIT_SCOPE "/init.scope"
> +void prune_init_scope(char *cg)
> +{
> + char *point = cg + strlen(cg) - strlen(INIT_SCOPE);
> + if (point < cg)
> + return;
> + if (strcmp(point, INIT_SCOPE) == 0) {
> + if (point == cg)
> + *(point+1) = '\0';
> + else
> + *point = '\0';
> + }
> +}
> diff --git a/src/lxc/cgroup.h b/src/lxc/cgroup.h
> index 6706939..7704c04 100644
> --- a/src/lxc/cgroup.h
> +++ b/src/lxc/cgroup.h
> @@ -80,4 +80,6 @@ extern bool cgroup_unfreeze(struct lxc_handler *handler);
> extern void cgroup_disconnect(void);
> extern cgroup_driver_t cgroup_driver(void);
>
> +extern void prune_init_scope(char *cg);
> +
> #endif
> --
> 2.5.0
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
["signature.asc" (application/pgp-signature)]
[Attachment #6 (text/plain)]
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic