[lxc-devel] [PATCH] One more rename of the system options

Serge Hallyn serge.hallyn at ubuntu.com
Fri Jan 10 22:57:16 UTC 2014


Quoting Stéphane Graber (stgraber at ubuntu.com):
> This should be the last change of name for those options. This change
> basically move them all to lxc.bdev.<backend>.<option>.
> 
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>

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

Though what is this going to do to people like me who already have
things like

lvm_vg = vg0
zfsroot = lxc

What is the best way to warn people?  Can we autodetect the old entries
and spit out a helpful warning?

> ---
>  src/lxc/bdev.c           | 12 ++++++------
>  src/lxc/lxc.functions.in |  4 ++--
>  src/lxc/lxc_config.c     |  6 +++---
>  src/lxc/utils.c          | 14 +++++++-------
>  4 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
> index a655756..7dec7c6 100644
> --- a/src/lxc/bdev.c
> +++ b/src/lxc/bdev.c
> @@ -565,7 +565,7 @@ static int zfs_clone(const char *opath, const char *npath, const char *oname,
>  			return -1;
>  		*p = '\0';
>  	} else
> -		zfsroot = lxc_global_config_value("lxc.zfsroot");
> +		zfsroot = lxc_global_config_value("lxc.bdev.zfs.root");
>  
>  	ret = snprintf(option, MAXPATHLEN, "-omountpoint=%s/%s/rootfs",
>  		lxcpath, nname);
> @@ -695,7 +695,7 @@ static int zfs_create(struct bdev *bdev, const char *dest, const char *n,
>  	pid_t pid;
>  
>  	if (!specs || !specs->zfs.zfsroot)
> -		zfsroot = lxc_global_config_value("lxc.zfsroot");
> +		zfsroot = lxc_global_config_value("lxc.bdev.zfs.root");
>  	else
>  		zfsroot = specs->zfs.zfsroot;
>  
> @@ -982,7 +982,7 @@ static int lvm_clonepaths(struct bdev *orig, struct bdev *new, const char *oldna
>  				orig->type);
>  			return -1;
>  		}
> -		vg = lxc_global_config_value("lxc.lvm_vg");
> +		vg = lxc_global_config_value("lxc.bdev.lvm.vg");
>  		len = strlen("/dev/") + strlen(vg) + strlen(cname) + 2;
>  		if ((new->src = malloc(len)) == NULL)
>  			return -1;
> @@ -1032,7 +1032,7 @@ static int lvm_clonepaths(struct bdev *orig, struct bdev *new, const char *oldna
>  			return -1;
>  		}
>  	} else {
> -		if (do_lvm_create(new->src, size, lxc_global_config_value("lxc.lvm_thin_pool")) < 0) {
> +		if (do_lvm_create(new->src, size, lxc_global_config_value("lxc.bdev.lvm.thin_pool")) < 0) {
>  			ERROR("Error creating new lvm blockdev");
>  			return -1;
>  		}
> @@ -1071,11 +1071,11 @@ static int lvm_create(struct bdev *bdev, const char *dest, const char *n,
>  
>  	vg = specs->lvm.vg;
>  	if (!vg)
> -		vg = lxc_global_config_value("lxc.lvm_vg");
> +		vg = lxc_global_config_value("lxc.bdev.lvm.vg");
>  
>  	thinpool = specs->lvm.thinpool;
>  	if (!thinpool)
> -		thinpool = lxc_global_config_value("lxc.lvm_thin_pool");
> +		thinpool = lxc_global_config_value("lxc.bdev.lvm.thin_pool");
>  
>  	/* /dev/$vg/$lv */
>  	if (specs->lvm.lv)
> diff --git a/src/lxc/lxc.functions.in b/src/lxc/lxc.functions.in
> index 3a71262..294ffb1 100644
> --- a/src/lxc/lxc.functions.in
> +++ b/src/lxc/lxc.functions.in
> @@ -26,5 +26,5 @@ templatedir=@LXCTEMPLATEDIR@
>  lxcinitdir=@LXCINITDIR@
>  
>  lxc_path=`lxc-config lxc.lxcpath`
> -lxc_vg=`lxc-config lxc.lvm_vg`
> -lxc_zfsroot=`lxc-config lxc.zfsroot`
> +lxc_vg=`lxc-config lxc.bdev.lvm.vg`
> +lxc_zfsroot=`lxc-config lxc.bdev.zfs.root`
> diff --git a/src/lxc/lxc_config.c b/src/lxc/lxc_config.c
> index c4797b5..dc8827c 100644
> --- a/src/lxc/lxc_config.c
> +++ b/src/lxc/lxc_config.c
> @@ -33,9 +33,9 @@ static struct lxc_config_items items[] =
>  {
>  	{ .name = "lxc.default_config", },
>  	{ .name = "lxc.lxcpath", },
> -	{ .name = "lxc.lvm_vg", },
> -	{ .name = "lxc.lvm_thin_pool", },
> -	{ .name = "lxc.zfsroot", },
> +	{ .name = "lxc.bdev.lvm.vg", },
> +	{ .name = "lxc.bdev.lvm.thin_pool", },
> +	{ .name = "lxc.bdev.zfs.root", },
>  	{ .name = NULL, },
>  };
>  
> diff --git a/src/lxc/utils.c b/src/lxc/utils.c
> index f860421..3755bcd 100644
> --- a/src/lxc/utils.c
> +++ b/src/lxc/utils.c
> @@ -241,13 +241,13 @@ static char *copy_global_config_value(char *p)
>  const char *lxc_global_config_value(const char *option_name)
>  {
>  	static const char * const options[][2] = {
> -		{ "lxc.lvm_vg",          DEFAULT_VG      },
> -		{ "lxc.lvm_thin_pool",   DEFAULT_THIN_POOL },
> -		{ "lxc.zfsroot",         DEFAULT_ZFSROOT },
> -		{ "lxc.lxcpath",         NULL            },
> -		{ "lxc.default_config",  NULL            },
> -		{ "lxc.cgroup.pattern",  DEFAULT_CGROUP_PATTERN },
> -		{ "lxc.cgroup.use",      NULL            },
> +		{ "lxc.bdev.lvm.vg",        DEFAULT_VG      },
> +		{ "lxc.bdev.lvm.thin_pool", DEFAULT_THIN_POOL },
> +		{ "lxc.bdev.zfs.root",      DEFAULT_ZFSROOT },
> +		{ "lxc.lxcpath",            NULL            },
> +		{ "lxc.default_config",     NULL            },
> +		{ "lxc.cgroup.pattern",     DEFAULT_CGROUP_PATTERN },
> +		{ "lxc.cgroup.use",         NULL            },
>  		{ NULL, NULL },
>  	};
>  
> -- 
> 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