[libvirt-users] signal for shutdown in lxc driver

Boris Savelev boris.savelev at gmail.com
Fri Nov 20 13:19:59 UTC 2015


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.

So, is this a bug?-)

[1] https://github.com/libvirt/libvirt/blob/master/src/lxc/lxc_driver.c#L3681
[2] https://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/init/main.c#L945
[3] http://man7.org/linux/man-pages/man1/lxc-stop.1.html

-- 
Boris




More information about the libvirt-users mailing list