]> 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)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 1 Jul 2015 15:47:22 +0000 (11:47 -0400)
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 6f44975dcb630f3d5b1ea917aa29258133b2bef2..152906f377c6357bd8f08c819b021b189714f4b2 100644 (file)
@@ -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)