]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
do_lxcap_stop: wait until container is stopped
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 14 Apr 2015 14:28:20 +0000 (09:28 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 14 Apr 2015 14:28:20 +0000 (09:28 -0500)
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 <serge.hallyn@ubuntu.com>
src/lxc/lxccontainer.c

index 5b96b8c50c189c57813274a69ad50a19fc568b30..e86151c91a4871a342acc6673bcfbcf0ad108bbc 100644 (file)
@@ -852,7 +852,10 @@ static bool do_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;
 }
 
 WRAP_API(bool, lxcapi_stop)