2015-11-20 18:19 GMT+03:00 Daniel P. Berrange <berrange(a)redhat.com>:
On Fri, Nov 20, 2015 at 04:19:59PM +0300, Boris Savelev wrote:
> Hello!
>
> Try to use libvirt with lxc.
> I use latest centos6 amd64 as a libvirt host (libvirt from xen4 repo)
> libvirt-daemon-1.2.15-3.el6.x86_64
> In container I also use latest centos6 amd64. Container starts with
> /sbin/init. CentOS 6 came with upstart as default init.
>
> My problem is that I could not shutdown container correctly with libvirt.
> virsh -c lxc:/// shutdown test
> Domain test is being shutdown
> In container I see only:
> "init: Re-executing /sbin/init"
> in syslog messages
>
> Why it is happened?
> lxcDomainShutdownFlags [1] send SIGTERM to initpid. Upstart got it and
> reloaded himself instead shutdown. It's default behavior... [2]
> The question is why libvirt send SIGTERM? As I can see lxc-stop [3]
> send SIGPWR (that works correctly with upstart) and also have ability
> to change default signals.
>
> I can understand that when container start with some script not
> /sbin/init that handle SIGTERM this situation is ok. But then
> container use /sbin/init it is not.
The choice of signal is essentially abitrary, since there is no
common standard used across different init systems. As such we
chose signal numbers that were useful in the context of containers
running applications (ie containers with an init). We then added
logic to be able to use /dev/initctl to trigger shutdown of init
based containers. This works with sysvinit and with systemd,
and various other init systems, but it seems upstart does not
support this. If there is another mechanism for instructing
upstart to shutdown that we can reliably detect, then we could
use that.
Yes, I agree. In this case signal could be configurable (like in generic lxc).
You are right, upstart doesn't support /dev/initctl (
But upstart shutdown correct with SIGPWR (30).
--
Boris