[systemd-devel] [PATCH] shutdown: do reboot() for openvz container

Lennart Poettering lennart at poettering.net
Wed Sep 12 14:54:12 PDT 2012

On Wed, 12.09.12 11:51, Daniel P. Berrange (berrange at redhat.com) wrote:

> On Wed, Sep 12, 2012 at 02:47:48PM +0400, Kir Kolyshkin wrote:
> > On 09/11/2012 05:24 AM, Lennart Poettering wrote:
> > >On Fri, 24.08.12 16:22, Kir Kolyshkin (kir at openvz.org) wrote:
> > >
> > >>Proper handling of reboot() syscall issued from the inside of a container
> > >>was always supported by OpenVZ kernels. More to say, OpenVZ relies on the fact
> > >>that container calls reboot in order to distinguish between shutdown and
> > >>reboot-- in the latter case container is being restarted.
> > >>
> > >>This patch brings the reboot() back for OpenVZ container.
> > >Turns out the normal Linux containers understand reboot() just fine
> > >too.
> > 
> > Please note though that the problem with reboot() wrt upstream containers
> > was really nasty -- calling reboot inside container resulted in
> > rebooting the whole system, not just the container.
> NB when libvirt starts an LXC container, it first checks to see whether
> the kernel has the container aware reboot() support. If it does not,
> then it removes CAP_SYS_REBOOT from the container, to prevent any
> accidental whole system reboot. The sf.net LXC tools do the same thing.

How do you check that? A version check or can you actually detect this
feature explicitly?


Lennart Poettering - Red Hat, Inc.

More information about the systemd-devel mailing list