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

Daniel Lezcano daniel.lezcano at free.fr
Sun Sep 16 19:14:01 UTC 2012


On 09/13/2012 05:22 PM, Christian Seiler wrote:
> This patch adds a simple notification system that allows the container to
> notify the host (in particular, the lxc-start process) that the boot process
> has been completed successfully. It also adds an additional status BOOTING
> that lxc-info may return. This allows the administrator and scripts to
> distinguish between a fully-running container and a container that is still
> in the process of booting.

The feature sounds reasonable.

> If nothing is added to the configuration file, the current behavior is not
> changed, i.e. after lxc-start finishes the initialization, the container is
> immediately put into the RUNNING state. This ensures backwards
> compatibility.
>
> If lxc.notification.type is set to 'fifo', after lxc-start initialization
> the container is initially put into the state BOOTING. Also, the FIFO
> /var/lib/lxc/%s/notification-fifo is created and bind-mounted into the
> container, by default to /dev/lxc-notify, but this can be changed via the
> lxc.notification.path configuration setting.

It is a bit weird to bind mount this fifo. Furthermore, I would suggest
to prevent using a fifo it is prone to problems and could hang the
supervisor process (aka lxc-start).

Maybe here a simple file in the rootfs let's say
rootfs/var/run/lxc-notify would be sufficient.
>From lxc-start monitor this file and when it is created or modified or
whatever, the system running the container is booted.

I suggest to decorrelate the states sent by lxc-start to lxc-info and so
from this notification mechanism.

> Inside the container one may execute 'echo RUNNING > /dev/lxc-notify' or an
> equivalent command to notify lxc-start that the container has now booted.
> Similarly, 'echo STOPPING > /dev/lxc-notify' will change the status to
> STOPPING, which may be done on shutdown. Currently, only RUNNING and
> STOPPING are allowed, other states are ignored.

How the process writing the "STOPPING" string can know the container is
shutting down ?

Thanks
  -- Daniel





More information about the lxc-devel mailing list