From 16a64224c5417fe26c4a01496656a1a4c78eae3c Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Tue, 14 Apr 2015 09:28:20 -0500 Subject: [PATCH] do_lxcap_stop: wait until container is stopped In the past, lxc-cmd-stop would wait until the command pipe was closed before returning, ensuring that the container monitor had exited. Now that we accept the actual success return value, lxcapi_stop can return success before the monitor has fully exited. So explicitly wait for the container to stop, when lxc-cmd-stop returned success. Signed-off-by: Serge Hallyn --- src/lxc/lxccontainer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 6f44975dc..152906f37 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -753,7 +753,10 @@ static bool lxcapi_stop(struct lxc_container *c) ret = lxc_cmd_stop(c->name, c->config_path); - return ret == 0; + if (ret == 0) + return do_lxcapi_wait(c, "STOPPED", 10); + + return false; } static int do_create_container_dir(const char *path, struct lxc_conf *conf) -- 2.47.2