[Lxc-users] On clean shutdown of Ubuntu 10.04 containers

Brian K. White brian at aljex.com
Tue Dec 7 00:36:16 UTC 2010


On 12/6/2010 6:49 PM, Trent W. Buck wrote:
> "Brian K. White"<brian at aljex.com>  writes:
>
>> On 12/6/2010 2:42 AM, Trent W. Buck wrote:
>>> I use the latter in my customized /etc/init.d/lxc stop rule.
>>> Note that the lxc-wait's SHOULD be parallelized, but this is not
>>> possible as at lxc 0.7.2 :-(
>>
>> Sure it is.
>
> Sorry, I meant lxc-wait(8) cannot be parallelized.
>
>> I parallelize the shutdowns (in any version, including 0.7.2) by doing
>> all the lxc-stop in parallel without looking or waiting,
>
> Correct me if I'm wrong, but lxc-stop does NOT do a clean shutdown -- it
> just kill -9's all the processes in the container.

If you read the script, I do not issue lxc-stop anywhere directly, I 
only issue "kill -PWR $PID" where $PID is the containers /sbin/init.

lxc does the actual lxc-stop internally if/when the container reaches 
the state where it's ok to do so.

In previous version for 0.6.5 I would actually issue lxc-stop 
eventually, but still only after issuing the kill -PWR and waiting for 
the container to reach the stopped state on it's own both by lxc-info 
and by the cgroup tasks file. That could be just as parallel although 
why bother writing it since it's no longer necessary.

One problem with this is it means a hung or misconfigured container can 
prevent the host from ever shutting down (gracefully) which I think is 
preferable to the other way around except for the case of if the host is 
trying to go down because of impending power outtage.

Usually I will not be shutting down a vps host lightly, or unattended, 
so it's ok that if a container turns out to be buggy and hangs the 
shutdown, the admin sees that during the shutdown and goes and deals 
with it one way or another on the spot.

But the UPS alert case is an important one and I really should do 
something to handle that specially. In the UPS alert case I'd rather the 
host go down gracefully at the expense of the bad guest rather than a 
bad guest making the host lose power ungracefully. Especially seeing as 
how I use software raid a lot.

-- 
bkw




More information about the lxc-users mailing list