[lxc-devel] -L option with lxc-start

Serge Hallyn serge.hallyn at ubuntu.com
Fri May 30 17:17:20 UTC 2014


Quoting Michael H. Warfield (mhw at WittsEnd.com):
> On Sat, 2014-05-24 at 22:15 +0000, Serge Hallyn wrote:
> > Quoting William Dauchy (wdauchy at gmail.com):
> > > Hello,
> > > 
> > > lxc1 did a modification in the lxc.console behaviour (compared to the
> > > previous version)
> > > Indeed, in the config file lxc.console now accept a tty and not a file.
> > > I now need to use -L with lxc-start to get logs in a file.
> > > 
> > > The problem raised is now I don't have a -L equivalent in config like
> > > before. Correct me if I'm wrong.
> > > 
> > > lxc.console in config file:
> > > % git grep -F console.path
> > > lxc/conf.c:     new->console.path = NULL;
> > > lxc/conf.c:     if (conf->console.path)
> > > lxc/conf.c:             free(conf->console.path);
> > > lxc/confile.c:  return config_path_item(&lxc_conf->console.path, value);
> > > lxc/confile.c:          v = c->console.path;
> > > lxc/confile.c:  if (c->console.path)
> > > lxc/confile.c:          fprintf(fout, "lxc.console = %s\n", c->console.path);
> > > lxc/lxc_start.c:        if (ensure_path(&conf->console.path,
> > > my_args.console) < 0) {
> > > lxc/start.c:    if (conf->console.path && setenv("LXC_CONSOLE",
> > > conf->console.path, 1)) {
> > > 
> > > -L with lxc-start, no equivalent in config file:
> > > % git grep -F console.log_path
> > > lxc/conf.c:     new->console.log_path = NULL;
> > > lxc/lxc_start.c:        if (ensure_path(&conf->console.log_path,
> > > my_args.console_log) < 0) {
> > > lxc/start.c:    if (conf->console.log_path &&
> > > setenv("LXC_CONSOLE_LOGPATH", conf->console.log_path, 1)) {
> > 
> > Indeed, it looks like we need a patch to confile.c to add a
> > config_console_logfile() helper to set that.  Would you be
> > interested in writing that patch?
> 
> Wait a second.  I recall something along these lines being discussed
> years ago and, iirc, you pointed out to us that there's a chicken and
> egg situation in there that there are logging calls in the options
> parsing and processing and there was some problem with switching log
> file mid-stream or initializing or stuff.  Seems like I remember those
> log files and consoles being sensitive to when they were initialized...
> 
> We may want to be very careful there.

That sounds like it would relate to the lxc logging.  This is
console.log_fd, which iirc is a write-only log of the container
console.


More information about the lxc-devel mailing list