[lxc-devel] detecting reboot/halt...
Daniel Lezcano
dlezcano at fr.ibm.com
Thu Apr 8 08:38:05 UTC 2010
Michael Tokarev wrote:
> I come across a series of patches to implement
> reboot/halt of a container. Patches were discussed
> before, but I had no time to look at that stuff in
> more detail...
> The problem. The current detection is based on the
> content of container's /var/run/utmp. This is goood
> provided the container actually touches that file,
> but this is not true for "single-application"
> containers, i.e. the ones without full init.d
> system.
Mmmh, yes that's something I thought about but I assumed an application
container will not do 'shutdown' or/and run as root. But maybe I missed
one kind of application, do you have in mind a particular one ?
> There are only two reliable ways to get this to work:
> it's either catching sys_reboot() (for which kernel
> support/changes is needed), or replacing poweroff or
> halt (or introducing a separate utility) which will
> notify the parent process about the event in some
> way (sending signal, connecting to a socket, writing
> something to a pipe and the like).
The first solution (catch at the kernel level) is a better solution
covering all the cases. Adding extra utilities is not easy to manage
because of the OS update and package dependencies.
> I remember something of that sort were proposed
> too, but I can't find the details now. Are there
> some patches or git branch with that stuff?
Yep, I did a quick hack in sys_reboot sending a SIGPWR to the parent of
the pid namespace when this one is not the init_pid_ns, but I didn't had
time to propose/send an acceptable version and argue for it on
lkml@/containers at . Furthermore, before sending a patch to the kernel, we
have to be sure this problem can't be solved from userspace first.
Thanks
-- Daniel
More information about the lxc-devel
mailing list