From: Dwight Engen Date: Fri, 3 Jan 2014 19:36:43 +0000 (-0500) Subject: rename lxc-stop shutdown argument to nokill X-Git-Tag: lxc-1.0.0.beta2~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84fbfcb434f5a59680b7f017bbc1d0db0b81a39d;p=thirdparty%2Flxc.git rename lxc-stop shutdown argument to nokill This makes the arguments between lxc-stop and lxc-autostart more consistent, so that --shutdown doesn't have two different meanings. Signed-off-by: Dwight Engen Acked-by: Stéphane Graber --- diff --git a/doc/lxc-stop.sgml.in b/doc/lxc-stop.sgml.in index 09ea5d6be..bdb0ef5d8 100644 --- a/doc/lxc-stop.sgml.in +++ b/doc/lxc-stop.sgml.in @@ -54,7 +54,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -r -t timeout -k - -s + --nokill + --nolock @@ -68,11 +69,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA the container), wait 60 seconds for the container to exit, and returns. If the container fails to cleanly exit, then after 60 seconds the container will be sent the - lxc.stopsignal to force it to shut down. + lxc.stopsignal to force it to shut down. If + lxc.stopsignal is not specified, the signal sent is + SIGKILL. - The -W, -r, -s - and -k options specify the action to perform. + The -W, -r, + -k and --nokill + options specify the action to perform. -W indicates that after performing the specified action, lxc-stop should immediately exit, while -t TIMEOUT specifies the maximum amount of time @@ -97,25 +101,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + - Only request a clean shutdown, do not kill the container tasks if the - clean shutdown fails. + Rather than requesting a clean shutdown of the container, explicitly + kill all tasks in the container. This is the legacy + lxc-stop behavior. - + - Rather than requesting a clean shutdown of the container, explicitly - kill all tasks in the container. This is the legacy - lxc-stop behavior. + Only request a clean shutdown, do not kill the container tasks if the + clean shutdown fails. diff --git a/src/lxc/arguments.h b/src/lxc/arguments.h index 954ddccfc..2fa24c0a3 100644 --- a/src/lxc/arguments.h +++ b/src/lxc/arguments.h @@ -65,16 +65,19 @@ struct lxc_arguments { int ttynum; char escape; - /* for lxc-wait and lxc-shutdown */ + /* for lxc-wait */ char *states; long timeout; - int nowait; - int reboot; - int hardstop; + + /* for lxc-autostart */ int shutdown; /* for lxc-stop */ + int hardstop; + int nokill; int nolock; + int nowait; + int reboot; /* for lxc-destroy */ int force; diff --git a/src/lxc/lxc_stop.c b/src/lxc/lxc_stop.c index d0cf798f2..dc4133f5b 100644 --- a/src/lxc/lxc_stop.c +++ b/src/lxc/lxc_stop.c @@ -34,6 +34,7 @@ #include "utils.h" #define OPT_NO_LOCK OPT_USAGE+1 +#define OPT_NO_KILL OPT_USAGE+2 static int my_parser(struct lxc_arguments* args, int c, char* arg) { @@ -42,8 +43,8 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg) case 'W': args->nowait = 1; break; case 't': args->timeout = atoi(arg); break; case 'k': args->hardstop = 1; break; - case 's': args->shutdown = 1; break; case OPT_NO_LOCK: args->nolock = 1; break; + case OPT_NO_KILL: args->nokill = 1; break; } return 0; } @@ -53,7 +54,7 @@ static const struct option my_longopts[] = { {"nowait", no_argument, 0, 'W'}, {"timeout", required_argument, 0, 't'}, {"kill", no_argument, 0, 'k'}, - {"shutdown", no_argument, 0, 's'}, + {"no-kill", no_argument, 0, OPT_NO_KILL}, {"no-lock", no_argument, 0, OPT_NO_LOCK}, LXC_COMMON_OPTIONS }; @@ -72,7 +73,7 @@ Options :\n\ -t, --timeout=T wait T seconds before hard-stopping\n\ -k, --kill kill container rather than request clean shutdown\n\ --nolock Avoid using API locks\n\ - -s, --shutdown Only request clean shutdown, don't later force kill\n", + --nokill Only request clean shutdown, don't force kill after timeout\n", .options = my_longopts, .parser = my_parser, .checker = NULL, @@ -175,7 +176,7 @@ int main(int argc, char *argv[]) goto out; } - if (my_args.shutdown) + if (my_args.nokill) my_args.timeout = 0; s = c->shutdown(c, my_args.timeout);