[lxc-devel] [lxc/master] Raise STOPPING state during lxc-stop

Rachid-Koucha on Github lxc-bot at linuxcontainers.org
Sun Jan 27 01:06:44 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 467 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190126/3fef924b/attachment.bin>
-------------- next part --------------
From 01ed036a07295cfab8957718380755833e1b00c5 Mon Sep 17 00:00:00 2001
From: Rachid Koucha <47061324+Rachid-Koucha at users.noreply.github.com>
Date: Sun, 27 Jan 2019 02:06:17 +0100
Subject: [PATCH] Raise STOPPING state during lxc-stop

Before killing the processes in the container, raise the STOPPING state
as the action may take a long time.

Signed-off-by: Rachid Koucha <rachid.koucha at gmail.com>
---
 src/lxc/lxccontainer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 364c6c7a78..53f2ddf2e5 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -2120,6 +2120,10 @@ static bool do_lxcapi_shutdown(struct lxc_container *c, int timeout)
 		if (ret < MAX_STATE)
 			return false;
 	}
+	
+	/* Raise the STOPPING state */
+	lxc_cmd_serve_state_clients(c->name, c->config_path, STOPPING);
+	lxc_monitor_send_state(c->name, STOPPING, c->config_path);
 
 	/* Send shutdown signal to container. */
 	killret = kill(pid, haltsignal);


More information about the lxc-devel mailing list