[Lxc-users] [PATCH] ignore non-lxc configuration line

Michael H. Warfield mhw at WittsEnd.com
Thu Jun 2 00:10:05 UTC 2011


On Fri, 2011-05-13 at 22:32 +0200, Daniel Lezcano wrote: 
> From: Daniel Lezcano <daniel.lezcano at free.fr>

> We ignore the line of in the configuration file not beginning by "lxc."
> So we can mix the configuration file with another information used for
> another component through the lxc library.

Wow...

I seem to recall requesting this sort of thing ages ago.  Maybe even
before we created the -users list and only had the -dev list and was
shot down.  I have soooo wanted this feature.  That can implement many
of the OpenVZ compatibility things we need the high level scripts to
perform and keep them in one file.  Many thanks.  I as SO glad to see
this!

Regards,
Mike

> Signed-off-by: Daniel Lezcano <dlezcano at fr.ibm.com>
> ---
>  src/lxc/confile.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lxc/confile.c b/src/lxc/confile.c
> index 791f04f..d632404 100644
> --- a/src/lxc/confile.c
> +++ b/src/lxc/confile.c
> @@ -799,7 +799,7 @@ static int parse_line(char *buffer, void *data)
>  	char *dot;
>  	char *key;
>  	char *value;
> -	int ret = -1;
> +	int ret = 0;
>  
>  	if (lxc_is_line_empty(buffer))
>  		return 0;
> @@ -815,10 +815,14 @@ static int parse_line(char *buffer, void *data)
>  	}
>  
>  	line += lxc_char_left_gc(line, strlen(line));
> -	if (line[0] == '#') {
> -		ret = 0;
> +
> +	/* martian option - ignoring it, the commented lines beginning by '#'
> +	 * fall in this case
> +	 */
> +	if (strncmp(line, "lxc.", 4))
>  		goto out;
> -	}
> +
> +	ret = -1;
>  
>  	dot = strstr(line, "=");
>  	if (!dot) {

-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20110601/ef157865/attachment.pgp>


More information about the lxc-users mailing list