[lxc-devel] [PATCH] lxc-config can show lxc.cgroup.(use|pattern)

Serge Hallyn serge.hallyn at ubuntu.com
Tue Sep 30 19:48:09 UTC 2014


Quoting KATOH Yasufumi (karma at jazz.email.ne.jp):
> Signed-off-by: KATOH Yasufumi <karma at jazz.email.ne.jp>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

I think it would be worth also augmenting
lxc_global_config_value() to return a default lxc.cgroup.use
for 'all', and a default lxc.cgroup.pattern ("/lxc/%n" for root
or "%n" for non-root).

That doesn't need to be a part of this patch though, just
would be a nice-to-have follow-on :)

> ---
>  src/lxc/lxc_config.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/lxc_config.c b/src/lxc/lxc_config.c
> index 0658beb..d146ad8 100644
> --- a/src/lxc/lxc_config.c
> +++ b/src/lxc/lxc_config.c
> @@ -36,6 +36,8 @@ static struct lxc_config_items items[] =
>  	{ .name = "lxc.bdev.lvm.vg", },
>  	{ .name = "lxc.bdev.lvm.thin_pool", },
>  	{ .name = "lxc.bdev.zfs.root", },
> +	{ .name = "lxc.cgroup.use", },
> +	{ .name = "lxc.cgroup.pattern", },
>  	{ .name = NULL, },
>  };
>  
> @@ -58,6 +60,7 @@ static void list_config_items(void)
>  int main(int argc, char *argv[])
>  {
>  	struct lxc_config_items *i;
> +	const char *value;
>  
>  	if (argc < 2)
>  		usage(argv[0]);
> @@ -65,7 +68,11 @@ int main(int argc, char *argv[])
>  		list_config_items();
>  	for (i = &items[0]; i->name; i++) {
>  		if (strcmp(argv[1], i->name) == 0) {
> -			printf("%s\n", lxc_get_global_config_item(i->name));
> +			value = lxc_get_global_config_item(i->name);
> +			if (value)
> +				printf("%s\n", value);
> +			else
> +				printf("%s is not set.\n", argv[1]);
>  			exit(0);
>  		}
>  	}
> -- 
> 2.0.4
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list