[lxc-devel] [PATCH 2/2] Define LXC_DEFAULT_CONFIG

Stéphane Graber stgraber at ubuntu.com
Fri May 31 15:41:49 UTC 2013


On 05/31/2013 11:35 AM, Serge Hallyn wrote:
> And use it in place of the various ways we were deducing /etc/lxc/default.conf.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  configure.ac               | 1 +
>  src/lxc/Makefile.am        | 3 ++-
>  src/lxc/lxc_create.c       | 4 +---
>  src/lxc/lxccontainer.c     | 3 ---
>  src/tests/Makefile.am      | 3 ++-
>  src/tests/containertests.c | 2 +-
>  src/tests/destroytest.c    | 2 +-
>  src/tests/saveconfig.c     | 2 +-
>  src/tests/startone.c       | 2 +-
>  9 files changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 65751ce..4567001 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -218,6 +218,7 @@ AS_AC_EXPAND(BINDIR, "$bindir")
>  AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
>  AS_AC_EXPAND(INCLUDEDIR, "$includedir")
>  AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
> +AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
>  AS_AC_EXPAND(DATADIR, "$datadir")
>  AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
>  AS_AC_EXPAND(DOCDIR, "$docdir")
> diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
> index 70fcd25..18469a1 100644
> --- a/src/lxc/Makefile.am
> +++ b/src/lxc/Makefile.am
> @@ -94,7 +94,8 @@ AM_CFLAGS=-I$(top_srcdir)/src \
>  	-DLXC_GLOBAL_CONF=\"$(LXC_GLOBAL_CONF)\" \
>  	-DLXCINITDIR=\"$(LXCINITDIR)\" \
>  	-DLXCTEMPLATEDIR=\"$(LXCTEMPLATEDIR)\" \
> -	-DLOGPATH=\"$(LOGPATH)\"
> +	-DLOGPATH=\"$(LOGPATH)\" \
> +	-DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\"
>  
>  if ENABLE_APPARMOR
>  AM_CFLAGS += -DHAVE_APPARMOR
> diff --git a/src/lxc/lxc_create.c b/src/lxc/lxc_create.c
> index 2613604..9176d1f 100644
> --- a/src/lxc/lxc_create.c
> +++ b/src/lxc/lxc_create.c
> @@ -135,8 +135,6 @@ bool validate_bdev_args(struct lxc_arguments *a)
>  	return true;
>  }
>  
> -/* grab this through autoconf from @config-path@ ? */
> -#define DEFAULT_CONFIG "/etc/lxc/default.conf"
>  int main(int argc, char *argv[])
>  {
>  	struct lxc_container *c;
> @@ -174,7 +172,7 @@ int main(int argc, char *argv[])
>  	if (my_args.configfile)
>  		c->load_config(c, my_args.configfile);
>  	else
> -		c->load_config(c, DEFAULT_CONFIG);
> +		c->load_config(c, LXC_DEFAULT_CONFIG);
>  
>  	if (strcmp(my_args.bdevtype, "zfs") == 0) {
>  		if (my_args.zfsroot)
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index 24b6008..61e1327 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -1158,9 +1158,6 @@ static int lxcapi_get_keys(struct lxc_container *c, const char *key, char *retv,
>  	return ret;
>  }
>  
> -
> -/* default config file - should probably come through autoconf */
> -#define LXC_DEFAULT_CONFIG "/etc/lxc/default.conf"
>  static bool lxcapi_save_config(struct lxc_container *c, const char *alt_file)
>  {
>  	FILE *fout;
> diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
> index ba24d2c..be036e3 100644
> --- a/src/tests/Makefile.am
> +++ b/src/tests/Makefile.am
> @@ -20,7 +20,8 @@ AM_CFLAGS=-I$(top_srcdir)/src \
>  	-DLXCROOTFSMOUNT=\"$(LXCROOTFSMOUNT)\" \
>  	-DLXCPATH=\"$(LXCPATH)\" \
>  	-DLXC_GLOBAL_CONF=\"$(LXC_GLOBAL_CONF)\" \
> -	-DLXCINITDIR=\"$(LXCINITDIR)\"
> +	-DLXCINITDIR=\"$(LXCINITDIR)\" \
> +	-DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\"
>  
>  bin_PROGRAMS = lxc-test-containertests lxc-test-locktests lxc-test-startone \
>  	lxc-test-destroytest lxc-test-saveconfig lxc-test-createtest \
> diff --git a/src/tests/containertests.c b/src/tests/containertests.c
> index 8868faa..8d1658f 100644
> --- a/src/tests/containertests.c
> +++ b/src/tests/containertests.c
> @@ -71,7 +71,7 @@ static int create_busybox(void)
>  		return -1;
>  	}
>  	if (pid == 0) {
> -		ret = execlp("lxc-create", "lxc-create", "-t", "busybox", "-f", "/etc/lxc/default.conf", "-n", MYNAME, NULL);
> +		ret = execlp("lxc-create", "lxc-create", "-t", "busybox", "-f", LXC_DEFAULT_CONFIG, "-n", MYNAME, NULL);
>  		// Should not return
>  		perror("execl");
>  		exit(1);
> diff --git a/src/tests/destroytest.c b/src/tests/destroytest.c
> index 0552b4c..428d09e 100644
> --- a/src/tests/destroytest.c
> +++ b/src/tests/destroytest.c
> @@ -38,7 +38,7 @@ static int create_ubuntu(void)
>  		return -1;
>  	}
>  	if (pid == 0) {
> -		ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-f", "/etc/lxc/default.conf", "-n", MYNAME, NULL);
> +		ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-f", LXC_DEFAULT_CONFIG, "-n", MYNAME, NULL);
>  		// Should not return
>  		perror("execl");
>  		exit(1);
> diff --git a/src/tests/saveconfig.c b/src/tests/saveconfig.c
> index fa84e32..649573f 100644
> --- a/src/tests/saveconfig.c
> +++ b/src/tests/saveconfig.c
> @@ -38,7 +38,7 @@ static int create_ubuntu(void)
>  		return -1;
>  	}
>  	if (pid == 0) {
> -		ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-f", "/etc/lxc/default.conf", "-n", MYNAME, NULL);
> +		ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-f", LXC_DEFAULT_CONFIG, "-n", MYNAME, NULL);
>  		// Should not return
>  		perror("execl");
>  		exit(1);
> diff --git a/src/tests/startone.c b/src/tests/startone.c
> index 591399d..d781e75 100644
> --- a/src/tests/startone.c
> +++ b/src/tests/startone.c
> @@ -70,7 +70,7 @@ static int create_ubuntu(void)
>  		return -1;
>  	}
>  	if (pid == 0) {
> -		ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-f", "/etc/lxc/default.conf", "-n", MYNAME, NULL);
> +		ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-f", LXC_DEFAULT_CONFIG, "-n", MYNAME, NULL);
>  		// Should not return
>  		perror("execl");
>  		exit(1);
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130531/78d468b9/attachment.pgp>


More information about the lxc-devel mailing list