[lxc-devel] [PATCH] Add mechanism for container to notify host about end of boot

Christian Seiler christian at iwakd.de
Fri Sep 14 11:23:11 UTC 2012


> I'm very pleased about the discussion and efforts to implement such a
> feature because I already have asked for it in former times. In the
> one hand, this fifo approach may be used for more than the current
> task. But in the other hand, it's seems to need a bunch of
> dependencies.

You mean that you have to modify the container? Yes. sure, but the
modification is rather trivial - one should just ping the notification
FIFO/socket/whatever at boot (on systems with LSB init in a rc.local or
similar script for example) to notify lxc that the container is booted.

What you seem to want is a way for lxc to detect that automatically
without any intervention from the container. I don't think that's
possible in any kind of way that is not a complete and utter hack,
since only the container itself can have any concept of whether it's
done with booting or not. Of course, if you assume that you have
sysvinit and LSB scripts, you can check whether the command line of
init in /proc is now "init [3]" and that /etc/init.d/rc 3 (or however
that is called on your distro) has finished running inside the
container and the process doesn't exist anymore. But that doesn't take
into account upstart or systemd or any other kind of init system.

If you can guarantee a certain environment, you could probably hack
something together along the above lines, but I personally don't think
that it would be a good idea for the much more general lxc code to
include some hack like this.

Christian





More information about the lxc-devel mailing list