]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
change lxc-autostart shutdown to behave like lxc-stop
authorDwight Engen <dwight.engen@oracle.com>
Tue, 31 Dec 2013 19:21:49 +0000 (14:21 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 2 Jan 2014 17:01:19 +0000 (11:01 -0600)
It is desirable to have a mode where a soft shutdown is requested,
but then do a hard shutdown if after some time period the container
has not shut down. This the default behaviour of lxc-stop, but is
not currently possible with lxc-autostart. This change makes this
the default behaviour when shutdown is specified to lxc-autostart.
This will be very useful for init scripts.

An indefinte wait for soft shutdown (though I'm not sure how that
would be useful) is still possible by passing a timeout of 0.

Change default timeout value to 60 seconds to match lxc-stop

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
doc/lxc-autostart.sgml.in
src/lxc/lxc_autostart.c

index 2f132ade90f4ab45250a25999969ac4dde0991ac..99ee7facdbaf6372fecc646214f51b656e5ed39f 100644 (file)
@@ -103,8 +103,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
                 </term>
                 <listitem>
                     <para>
-                        Only request a clean shutdown, do not kill the
-                        container tasks if the clean shutdown fails.
+                        Request a clean shutdown. If a
+                        <optional>-t timeout</optional> greater than 0 is
+                        given and the container has not shut down within
+                        this period, it will be killed as with the
+                        <optional>-k kill</optional> option.
                     </para>
                 </listitem>
             </varlistentry>
index f6e6bfc7f342fc895e7503b4a1913aa4e38e8968..b03de4f58f390c07a26918df4c72e1a7a0512700 100644 (file)
@@ -71,7 +71,7 @@ Options:\n\
        .options  = my_longopts,
        .parser   = my_parser,
        .checker  = NULL,
-       .timeout = 30,
+       .timeout = 60,
 };
 
 int lists_contain_common_entry(struct lxc_list *p1, struct lxc_list *p2) {
@@ -273,7 +273,6 @@ int main(int argc, char *argv[])
                                if (my_args.list)
                                        printf("%s\n", c->name);
                                else {
-                                       my_args.timeout = 0;
                                        if (!c->shutdown(c, my_args.timeout))
                                                fprintf(stderr, "Error shutting down container: %s\n", c->name);
                                }