[lxc-devel] [PATCH] Fix lxc-stop's -W / --nowait handling

Stéphane Graber stgraber at ubuntu.com
Fri Jan 31 18:09:35 UTC 2014


On Fri, Jan 31, 2014 at 11:52:26AM +0100, Robert Vogelgesang wrote:
> Fix lxc-stop's -W / --nowait handling.
> 
> Note that this explicitely changes --nokill to imply waiting forever,
> which was the implicit behaviour prior to my fix from today for
> lxcapi_shutdown().
> 
> Signed-off-by: Robert Vogelgesang <vogel at users.sourceforge.net>

I'm not going to take that patch as I believe my change which just
landed does cover all the cases we care about and should be sufficient.

> 
> diff -up lxc-lxc-1.0.0.beta3/src/lxc/lxc_stop.c.orig lxc-lxc-1.0.0.beta3/src/lxc/lxc_stop.c
> --- lxc-lxc-1.0.0.beta3/src/lxc/lxc_stop.c.orig	2014-01-30 19:07:20.940656328 +0100
> +++ lxc-lxc-1.0.0.beta3/src/lxc/lxc_stop.c	2014-01-31 10:41:21.971956566 +0100
> @@ -135,7 +135,6 @@ out:
>  int main(int argc, char *argv[])
>  {
>  	struct lxc_container *c;
> -	bool s;
>  	int ret = 1;
>  
>  	if (lxc_arguments_parse(&my_args, argc, argv))
> @@ -177,16 +176,13 @@ int main(int argc, char *argv[])
>  	}
>  
>  	if (my_args.nokill)
> +		my_args.timeout = -1;
> +
> +	if (my_args.nowait)
>  		my_args.timeout = 0;
>  
> -	s = c->shutdown(c, my_args.timeout);
> -	if (!s) {
> -		if (!my_args.shutdown)
> -			ret = c->wait(c, "STOPPED", -1) ? 0 : 1;
> -		else
> -			ret = 1; // fail
> -	} else
> -		ret = 0;
> +	if (c->shutdown(c, my_args.timeout))
> +		ret = 0; /* success */
>  
>  out:
>  	lxc_container_put(c);
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140131/2535cceb/attachment.pgp>


More information about the lxc-devel mailing list