From: Michael Tokarev <mjt-XAri/EZa3C4vJsYlp49lxw@public.gmane.org>
To: Andrian Nord <NightNord-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
lxc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [lxc-devel] Shutting down a container?
Date: Sat, 14 Nov 2009 14:17:45 +0300 [thread overview]
Message-ID: <4AFE91D9.10309@msgid.tls.msk.ru> (raw)
In-Reply-To: <20091113195229.GA2327-Ad3oKH0rFUpsEo8Uxu2CLw@public.gmane.org>
[I'm not really sure anymore what's the proper address:
the question at hand seems to be generic enough for
containers@]
Andrian Nord wrote:
> On Fri, Nov 13, 2009 at 06:58:01PM +0100, Daniel Lezcano wrote:
>> Michael Tokarev wrote:
>>> Should there be some different init perhaps, that will
>>> exit given some command or signal, instead of sysvinit?
>>> Or is there other way to shutdown a container?
>>>
>
> There is two techniques, that seems to be 'common':
> 1) Write your own init script, which would run every process you need
> and traping some signal via 'trap' that will exec an shutdown event.
> It has big advantage of lower overhead for rc-subsystem, but much more
> complicated to maintain.
Well, I don't quite see the complexity. sysvinit here is nothing more
than an equivalent of run-parts. It's the /etc/init.d/rc (or whatever
the path is on your distro) shell script who does all the fun stuff,
init itself basically does nothing but catching SIGCHLD and (re)starting
whatever is in inittab (which, in this case, should be very limited).
So I guess that a custom simple init-alike is all that's needed. The
main difference is that it should exit when there's no more processes
running or after some signal (like /dev/initctl, since process with pid=1
ignores signals).
> 2) Second technique is to rewrite container's /etc/inittab of sysvinit
> to have line like that:
> ca:12345:ctrlaltdel:/sbin/shutdown -hP now
>
> This is, obviously, what init should execute on ctrl-alt-del shortcut,
> actually triggered by SIGINT signal sent to init process.
For now I'm not worried about how to signal the "guest" to shut down.
it can be easily done by, say, attaching something to /dev/tty1 and
sening a command using lxc-console. Do unix sockets work between a
container and "host system" ?
What does not work for now is the final step. init process should exit
but it does not do that and can't be killed from within the container.
[]
> This is hack, yes, but there is no common way of inserting commands into
> container by now (there was such thread into lxc-devel maillist), but
> solution is found and needs implementing.
I'll dig there. But yet again, I'm fine with modifying the container
initscripts or something, the question really is what to do.
By the way, I for one see no reason why pid=1 in a container is special
when delivering signals or the like.
> Much worse situation is with syncing start procedure / waiting for
> network readyness =).
That again can be done by placing something into container that will
ping a given address when everything else is done.
Thanks!
/mjt
next prev parent reply other threads:[~2009-11-14 11:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-13 16:58 Shutting down a container? Michael Tokarev
[not found] ` <4AFD9031.6030102-Gdu+ltImwkhes2APU0mLOQ@public.gmane.org>
2009-11-13 17:58 ` Daniel Lezcano
[not found] ` <4AFD9E29.1030601-GANU6spQydw@public.gmane.org>
2009-11-13 20:18 ` [lxc-devel] " Andrian Nord
[not found] ` <20091113195229.GA2327-Ad3oKH0rFUpsEo8Uxu2CLw@public.gmane.org>
2009-11-14 11:17 ` Michael Tokarev [this message]
[not found] ` <4AFE91D9.10309-Gdu+ltImwkhes2APU0mLOQ@public.gmane.org>
2009-11-14 14:46 ` Andrian Nord
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AFE91D9.10309@msgid.tls.msk.ru \
--to=mjt-xari/eza3c4vjsylp49lxw@public.gmane.org \
--cc=NightNord-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=lxc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.