[lxc-devel] Shutting down containers properly

Ward, David - 0663 - MITLL david.ward at ll.mit.edu
Fri May 25 15:52:41 UTC 2012


On 25/05/12 11:28, Ward, David - 0663 - MITLL wrote:
> On 25/05/12 10:40, Christian Seiler wrote:
>> Hi,
>>
>>> my lxc management script uses lxc-stop just for an emergency action
>>> called "fored-stop" and it will be also applied, if a normal "stop"
>>> (alias "halt") action will timeout after 5min. For this normal
>>> shutdown (or reboot) of a container, I'm sending just a SIGPWR (or
>>> SIGINT) to the containers init (sysvinit) process. This will result
>>> into the same actions as one will call 'poweroff' or 'reboot' inside
>>> it.
>>
>> Yes, obviously that also works, but then you need to manually update
>> the inittab of a container and rewire reboot/power failure actions to
>> cause a shutdown as you describe.
>>
>> I'd really prefer shutting down a container just worked out of the box
>> without any strange modifications to /etc/inittab for sysvinit. I
>> really think shutting down containers properly is a functionality that
>> LXC should support out of the box.
>>
>
> Actually I believe the burden here ought to be on the container to
> handle SIGPWR properly...not on lxc to get involved in dealing with
> subtleties between different init systems that might be running in a
> container.
>
> (And yes, upstart handles SIGPWR with the 'power-status-changed' event:
> see http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf )
>
> If existing distros don't handle SIGPWR, then why don't we just modify
> the lxc-template so that it does? Or even fix the distro itself so that
> it does?
>
> David
>

To be clear, all I'm saying is that there should be a standard interface 
to shutting down containers (and it seems that others have settled on 
SIGPWR) -- lxc doesn't need to guess what is running inside it.  But I 
agree that we should still modify lxc-stop to actually use this interface.
-- 
David Ward, Associate Staff
Wideband Tactical Networking Group
MIT Lincoln Laboratory
Office: 781-981-4266
Mobile: 781-999-1925
Fax: 781-981-4583

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4558 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20120525/72c3d0dd/attachment.bin>


More information about the lxc-devel mailing list