[lxc-devel] [PATCH 1/4] Rename all lxc.conf options to lxc.<key>
Serge Hallyn
serge.hallyn at ubuntu.com
Fri Jan 10 05:55:13 UTC 2014
Quoting Stéphane Graber (stgraber at ubuntu.com):
> This is a first step in bringing the lxc.conf configfile in line with
> the container's format.
>
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
but I did want to ask whether you feel 'lxc.' is a good prefix for
these. Will 'lxc.cgroup.use' in global config versus
'lxc.cgroup.memory' in container config become confusing?
> ---
> src/lxc/lxc.functions.in | 6 +++---
> src/lxc/lxc_config.c | 8 ++++----
> src/lxc/utils.c | 26 +++++++++++++-------------
> 3 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/src/lxc/lxc.functions.in b/src/lxc/lxc.functions.in
> index 4c52f8c..3a71262 100644
> --- a/src/lxc/lxc.functions.in
> +++ b/src/lxc/lxc.functions.in
> @@ -25,6 +25,6 @@ bindir=@BINDIR@
> templatedir=@LXCTEMPLATEDIR@
> lxcinitdir=@LXCINITDIR@
>
> -lxc_path=`lxc-config lxcpath`
> -lxc_vg=`lxc-config lvm_vg`
> -lxc_zfsroot=`lxc-config zfsroot`
> +lxc_path=`lxc-config lxc.lxcpath`
> +lxc_vg=`lxc-config lxc.lvm_vg`
> +lxc_zfsroot=`lxc-config lxc.zfsroot`
> diff --git a/src/lxc/lxc_config.c b/src/lxc/lxc_config.c
> index 659501c..dcb3a3b 100644
> --- a/src/lxc/lxc_config.c
> +++ b/src/lxc/lxc_config.c
> @@ -32,10 +32,10 @@ struct lxc_config_items {
>
> static struct lxc_config_items items[] =
> {
> - { .name = "lxcpath", .fn = &lxc_get_default_config_path, },
> - { .name = "lvm_vg", .fn = &lxc_get_default_lvm_vg, },
> - { .name = "lvm_thin_pool", .fn = &lxc_get_default_lvm_thin_pool, },
> - { .name = "zfsroot", .fn = &lxc_get_default_zfs_root, },
> + { .name = "lxc.lxcpath", .fn = &lxc_get_default_config_path, },
> + { .name = "lxc.lvm_vg", .fn = &lxc_get_default_lvm_vg, },
> + { .name = "lxc.lvm_thin_pool", .fn = &lxc_get_default_lvm_thin_pool, },
> + { .name = "lxc.zfsroot", .fn = &lxc_get_default_zfs_root, },
> { .name = NULL, },
> };
>
> diff --git a/src/lxc/utils.c b/src/lxc/utils.c
> index 5f2c8b2..d06e1c0 100644
> --- a/src/lxc/utils.c
> +++ b/src/lxc/utils.c
> @@ -241,12 +241,12 @@ static char *copy_global_config_value(char *p)
> static const char *lxc_global_config_value(const char *option_name)
> {
> static const char * const options[][2] = {
> - { "lvm_vg", DEFAULT_VG },
> - { "lvm_thin_pool", DEFAULT_THIN_POOL },
> - { "zfsroot", DEFAULT_ZFSROOT },
> - { "lxcpath", NULL },
> - { "cgroup.pattern", DEFAULT_CGROUP_PATTERN },
> - { "cgroup.use", NULL },
> + { "lxc.lvm_vg", DEFAULT_VG },
> + { "lxc.lvm_thin_pool", DEFAULT_THIN_POOL },
> + { "lxc.zfsroot", DEFAULT_ZFSROOT },
> + { "lxc.lxcpath", NULL },
> + { "lxc.cgroup.pattern", DEFAULT_CGROUP_PATTERN },
> + { "lxc.cgroup.use", NULL },
> { NULL, NULL },
> };
>
> @@ -337,7 +337,7 @@ static const char *lxc_global_config_value(const char *option_name)
> }
> }
> /* could not find value, use default */
> - if (strcmp(option_name, "lxcpath") == 0)
> + if (strcmp(option_name, "lxc.lxcpath") == 0)
> values[i] = user_lxc_path;
> else {
> free(user_lxc_path);
> @@ -358,32 +358,32 @@ out:
>
> const char *default_lvm_vg(void)
> {
> - return lxc_global_config_value("lvm_vg");
> + return lxc_global_config_value("lxc.lvm_vg");
> }
>
> const char *default_lvm_thin_pool(void)
> {
> - return lxc_global_config_value("lvm_thin_pool");
> + return lxc_global_config_value("lxc.lvm_thin_pool");
> }
>
> const char *default_zfs_root(void)
> {
> - return lxc_global_config_value("zfsroot");
> + return lxc_global_config_value("lxc.zfsroot");
> }
>
> const char *default_lxc_path(void)
> {
> - return lxc_global_config_value("lxcpath");
> + return lxc_global_config_value("lxc.lxcpath");
> }
>
> const char *default_cgroup_use(void)
> {
> - return lxc_global_config_value("cgroup.use");
> + return lxc_global_config_value("lxc.cgroup.use");
> }
>
> const char *default_cgroup_pattern(void)
> {
> - return lxc_global_config_value("cgroup.pattern");
> + return lxc_global_config_value("lxc.cgroup.pattern");
> }
>
> const char *get_rundir()
> --
> 1.8.5.2
>
> _______________________________________________
> 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