libvirt-daemon-driver-lxc: container reboot done from inside or outside container shuts container down
Software environment
- Operating system: Linux
- Architecture: AMD64
- kernel version: 5.14.0-2-amd64
- libvirt version: 7.6.0
- Hypervisor and version: LXC
Description of problem
Fix reboot and shutdown command for LXC containers
The virNetDaemonQuit(dmn) command in virLXCControllerSignalChildIO triggers an early close of all clients of lxc_controller. Here, libvirtd itself is a client of this controller, and the client connection is used to notify libvirtd if a reboot of the container is required. However, the client connection was closed before such a status could be sent to libvirtd. To fix this bug, we will immediately send the reboot or shutdown status of the container to libvirtd, and only after client disconnect will we trigger virNetDaemonQuit.
Steps to reproduce
- create LXC container ContainerName
- virsh start ContainerName
- virsh reboot ContainerName
Expected container to reboot. Actual behavior, container does not reboot and remains shut down.
Additional information
See also Debian bug #991773
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991773