]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/confile.c
allocate a console to be proxied
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 24 Feb 2010 09:57:43 +0000 (10:57 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 24 Feb 2010 09:57:43 +0000 (10:57 +0100)
commit63376d7db32acf2f8582627e5ff01d8d3f0d46d1
tree16e49cc5157e91d5b3b3006e7ad023fd91b4cacb
parent246541036cf5434749d91a566b70b7ddcdb294bd
allocate a console to be proxied

The actual behaviour of the console is messy as:
 * it relies on a heuristic (tty or not, rootfs or not, etc ...)
 * the container init stole the tty and we lose the control

The following patch:
 * allocates a tty
 * maps this tty to the container console
 * proxy the io from the console to the file specified in the configuration
 lxc.console=<file>

That allows to specify a file, a fifo, a $(tty), and can be extended with an
uri like file://mypath, net://1.2.3.4:1234, etc ...
That solves the problem with the heuristic and the container does no longer stole
our current tty.

Note by default, the console output will go to a blackhole if no configuration is
specified making the container showing nothing.

In order to access the console from the tty, use

 lxc-start -n foo -s lxc.console=$(tty)

I propose the make the container to daemonize by default now.

I tried the following:

 in a shell:
  touch /var/lib/lxc/foo/console
  tail --retry -f /var/lib/lxc/foo/console
 in another shell:
  lxc-start -n foo -s lxc.console=/var/lib/lxc/foo/console

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/conf.c
src/lxc/conf.h
src/lxc/confile.c
src/lxc/console.c
src/lxc/console.h [new file with mode: 0644]
src/lxc/lxc_start.c
src/lxc/start.c