[lxc-devel] [RFC] lxc-start: daemonize by default

Stéphane Graber stgraber at ubuntu.com
Wed Apr 30 16:01:41 UTC 2014


I think our original plan to have LXC bind /dev/lxc in the container as
a standard unix socket with a basic plain text communication protocol is
still our best option.

I think initially we probably should allow three additional states:
 - READY
 - BROKEN
 - HALTING

Those would be the only states you can switch between from within the
container.


We'd also want to add an extra option for lxc-autostart
"lxc.start.ready_state" which would default to RUNNING but could be set
to READY. That way lxc-autostart will be able to wait for your
containers to be actually ready before starting the next one.


Obviously the actual state setting would have to be done by the local
administrator as there's no way to know what exactly they want to use
the states for. It may be about the network state of the container, or
the boot sequence or a particular service the container runs, so I think
it'd be best not to try and do that ourselves but just offer the bits
required for communication and document how this may be used.

On Wed, Apr 30, 2014 at 03:50:54PM +0000, Serge Hallyn wrote:
> Note that this would not work generically.  Each distro - and presumably until we
> standardize things, each user - will need to separately (1) install the init job
> to write to the pipe, (2)  set up the container config to create and bind in
> the fifo, and (3) write the program to wait on the fifo write (preferably with a
> timeout).  All I'm suggesting here is a generic way for lxc-start to be told
> how to wait for that thing to happen.  As I type this, it seems like it might
> be better to keep that functionality strictly in lxc-wait, and make the user
> use two calls, rather than complicate lxc-start and end up with a mess like we
> had in lxc-stop recently.
> 
> Quoting Guido Jäkel (G.Jaekel at DNB.DE):
> > Dear Serge,
> > 
> > Nice - a long time ago we discussed such a feature. The wrapper for my current LXC 0.8.4 production environment scan the log for a special console message to treat a container as "up and running".
> > 
> > greetings
> > 
> > Guido
> > 
> > On 2014-04-30 15:56, Serge Hallyn wrote:
> > > [...] and another to only return when SOME_PROGRAM
> > > returns - where SOME_PROGRAM might be waiting for an init
> > > script in the container to write 'ready' to a socket bound from
> > > the host - that way we know that the container has entered
> > > runlevel 2 or whatever.
> > 
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> _______________________________________________
> 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/20140430/575e6485/attachment-0001.sig>


More information about the lxc-devel mailing list