[lxc-devel] [PATCH] add lxc.console.logpath (v2)

Stéphane Graber stgraber at ubuntu.com
Wed Aug 6 22:42:30 UTC 2014


On Wed, Aug 06, 2014 at 10:39:45PM +0000, Serge Hallyn wrote:
> v2: add get_config_item
> 
> clear_config_item is not supported, as it isn't for lxc.console, bc
> you can do 'lxc.console.logfile =' to clear it.  Likewise save_config
> is not needed because the config is now just written through the
> unexpanded char*.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

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

> ---
>  doc/lxc.container.conf.sgml.in | 17 ++++++++++++++---
>  src/lxc/confile.c              | 10 ++++++++++
>  2 files changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/doc/lxc.container.conf.sgml.in b/doc/lxc.container.conf.sgml.in
> index a4485bc..121f882 100644
> --- a/doc/lxc.container.conf.sgml.in
> +++ b/doc/lxc.container.conf.sgml.in
> @@ -536,13 +536,24 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>        <variablelist>
>  	<varlistentry>
>  	  <term>
> -	    <option>lxc.console</option>
> +	    <option>lxc.console.logfile</option>
>  	  </term>
>  	  <listitem>
>  	    <para>
>  	      Specify a path to a file where the console output will
> -	      be written. The keyword 'none' will simply disable the
> -	      console. This is dangerous once if have a rootfs with a
> +	      be written.
> +	    </para>
> +	  </listitem>
> +	</varlistentry>
> +	<varlistentry>
> +	  <term>
> +	    <option>lxc.console</option>
> +	  </term>
> +	  <listitem>
> +	    <para>
> +	      Specify a path to a device to which the console will be
> +	      attached.  The keyword 'none' will simply disable the
> +	      console.  This is dangerous once if have a rootfs with a
>  	      console device file where the application can write, the
>  	      messages will fall in the host.
>  	    </para>
> diff --git a/src/lxc/confile.c b/src/lxc/confile.c
> index 26ac682..5de1241 100644
> --- a/src/lxc/confile.c
> +++ b/src/lxc/confile.c
> @@ -89,6 +89,7 @@ static int config_network_ipv6_gateway(const char *, const char *, struct lxc_co
>  static int config_cap_drop(const char *, const char *, struct lxc_conf *);
>  static int config_cap_keep(const char *, const char *, struct lxc_conf *);
>  static int config_console(const char *, const char *, struct lxc_conf *);
> +static int config_console_logfile(const char *, const char *, struct lxc_conf *);
>  static int config_seccomp(const char *, const char *, struct lxc_conf *);
>  static int config_includefile(const char *, const char *, struct lxc_conf *);
>  static int config_network_nic(const char *, const char *, struct lxc_conf *);
> @@ -146,6 +147,7 @@ static struct lxc_config_t config[] = {
>  	{ "lxc.network",              config_network              },
>  	{ "lxc.cap.drop",             config_cap_drop             },
>  	{ "lxc.cap.keep",             config_cap_keep             },
> +	{ "lxc.console.logfile",      config_console_logfile      },
>  	{ "lxc.console",              config_console              },
>  	{ "lxc.seccomp",              config_seccomp              },
>  	{ "lxc.include",              config_includefile          },
> @@ -1604,6 +1606,12 @@ static int config_console(const char *key, const char *value,
>  	return config_path_item(&lxc_conf->console.path, value);
>  }
>  
> +static int config_console_logfile(const char *key, const char *value,
> +			  struct lxc_conf *lxc_conf)
> +{
> +	return config_path_item(&lxc_conf->console.log_path, value);
> +}
> +
>  int append_unexp_config_line(const char *line, struct lxc_conf *conf)
>  {
>  	size_t len = conf->unexpanded_len, linelen = strlen(line);
> @@ -2261,6 +2269,8 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
>  		return lxc_get_cgroup_entry(c, retv, inlen, key + 11);
>  	else if (strcmp(key, "lxc.utsname") == 0)
>  		v = c->utsname ? c->utsname->nodename : NULL;
> +	else if (strcmp(key, "lxc.console.logfile") == 0)
> +		v = c->console.log_path;
>  	else if (strcmp(key, "lxc.console") == 0)
>  		v = c->console.path;
>  	else if (strcmp(key, "lxc.rootfs.mount") == 0)
> -- 
> 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/20140806/bd0e1a12/attachment-0001.sig>


More information about the lxc-devel mailing list