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

Oguz Bektas o.bektas at proxmox.com
Tue May 7 19:17:46 CEST 2019


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)) {
+		    PVE::LXC::vm_stop($vmid, 1);
+		}
+
 		return;
 	    };
 
-- 
2.11.0





More information about the pve-devel mailing list