[lxc-devel] [PATCH] load_config_locked: update unexp network

Stéphane Graber stgraber at ubuntu.com
Fri Aug 22 18:56:35 UTC 2014


On Fri, Aug 22, 2014 at 04:45:18AM +0000, Serge Hallyn wrote:
> When we read a lxc.network.hwaddr line, if it contained any 'x's then
> those get quitely filled in at config_network_hwaddr.  If that happens
> then we want to save the autogenerated hwaddr in the unexpanded config
> so that when we write it to disk, it is saved.
> 
> This patch dumbly re-generates the network configuration in the
> unexp configuration every time we load a config file, just as we do
> after every clone.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

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

> ---
>  src/lxc/lxccontainer.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index 0cf21ce..98174f4 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -412,9 +412,11 @@ static bool load_config_locked(struct lxc_container *c, const char *fname)
>  		c->lxc_conf = lxc_conf_init();
>  	if (!c->lxc_conf)
>  		return false;
> -	if (!lxc_config_read(fname, c->lxc_conf, false))
> -		return true;
> -	return false;
> +	if (lxc_config_read(fname, c->lxc_conf, false) != 0)
> +		return false;
> +	if (!clone_update_unexp_network(c->lxc_conf))
> +		return false;
> +	return true;
>  }
>  
>  static bool lxcapi_load_config(struct lxc_container *c, const char *alt_file)
> -- 
> 2.1.0.rc1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
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: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140822/27cef8b1/attachment.sig>


More information about the lxc-devel mailing list