On 3/6/19 7:39 PM, Maxim Kozin wrote:
LXC containers can be started, but time to time can't be
stopped.
1) virsh shutdown with option "--mode initctl" always stop container, but
virsh report error:
"Container does not provide an initctl pipe"
In container present /dev/initctl
2) virsh shutdown with option "--mode signal" never stop lxc container, at
least for centos 7.5/7.6
In container log:
systemd: Received SIGTERM.
systemd: Reexecuting.
systemd: systemd 219 running in system mode. (+PAM +AUDIT +SELINUX +IMA
-APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS
+ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
systemd: Detected virtualization lxc-libvirt.
systemd: Detected architecture x86-64.
3) virsh shutdown without option "--mode" can stop lxc container, but in 2
cases:
- cointainer not under heavy load
- in gdb when perform step-by-setp debug
But most often not, with simptoms as with --mode signal.
Patch tested only with host centos 7.6 and guests centos 7.5/7.6
Short comments to patch.
lxcDomainShutdownFlags() return rc=0 and container begin stopped.
We not go to endjob label, but later we pass check:
if (rc == 0 &&
(flags == 0 ||
(flags & VIR_DOMAIN_SHUTDOWN_SIGNAL))) {
And trying next shutdown method with sigterm to PID 1.
If container heavy loaded, it not stopped. IF not or if you wait in gdb, then
first method succefully perform shutdown.
Signed-off-by: Maxim Kozin <kolomaxes(a)gmail.com>
---
src/lxc/lxc_driver.c | 40 ++++++++++++++++++----------------------
1 file changed, 18 insertions(+), 22 deletions(-)
I've reworeded the commit message, ACKed and pushed.
Congratulations on your first libvirt contribution!
Michal