[pve-devel] [PATCH container] automatic forcestop for containers after timeout

Thomas Lamprecht t.lamprecht at proxmox.com
Tue May 7 19:21:39 CEST 2019


On 5/7/19 7:17 PM, Oguz Bektas wrote:
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
> 
> so i tested this and it works like expected, but one quirky thing i
> noticed while testing is, when we use ~5 > timeout > 0, there's a
> chance that the container is killed right before we check after the
> automatic timeout and we get this on screen because container can't be
> reached atm:
> lxc-stop: 102: commands_utils.c: lxc_cmd_sock_rcv_state: 70 Resource
> temporarily unavailable - Failed to receive message

> 
>  src/PVE/API2/LXC/Status.pm | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/PVE/API2/LXC/Status.pm b/src/PVE/API2/LXC/Status.pm
> index 95775fe..f6b3f48 100644
> --- a/src/PVE/API2/LXC/Status.pm
> +++ b/src/PVE/API2/LXC/Status.pm
> @@ -371,6 +371,10 @@ __PACKAGE__->register_method({
>  
>  		PVE::LXC::vm_stop($vmid, $param->{forceStop}, $timeout);
>  
> +		if (PVE::LXC::check_running($vmid)) {

nice try ;)
you now do this everytime, not checking if forceStop is actually set.

Out of interest, did you looked at the way qemu-server does it, and if,
why did you choose against doing it the same way (in principle)?

> +		    PVE::LXC::vm_stop($vmid, 1);> +		}
> +
>  		return;
>  	    };
>  
> 





More information about the pve-devel mailing list