[lxc-devel] lxc-stop inconsistencies

Robert Vogelgesang vogel at users.sourceforge.net
Fri Jan 31 10:41:20 UTC 2014


Hi,

On Thu, Jan 30, 2014 at 05:42:04PM +0100, Robert Vogelgesang wrote:
> On Thu, Jan 30, 2014 at 04:14:39PM +0000, Stéphane Graber wrote:
> > On Thu, Jan 30, 2014 at 04:40:17PM +0100, Robert Vogelgesang wrote:
> > > On Thu, Jan 30, 2014 at 03:36:35PM +0000, Stéphane Graber wrote:
> > > > On Thu, Jan 30, 2014 at 04:32:52PM +0100, Robert Vogelgesang wrote:
[...]
> > > > > in lxccontainer.c - in in this case, but this function does not support
> > > > > any form of "nowait".
> > > > 
> > > > shutdown(c, 0);
> > > 
> > > no, this waits forever.
> > 
> > Ok, so shutdown() is buggy.
> > 
> > The way it's supposed to work is:
> >  -1     => Wait forever
> >  0      => Don't wait
> >  > 0    => Wait for x seconds
> > 

in a few minutes I'll send two patches to the list.  The first fixes
lxcapi_shutdown() in lxccontainer.c to handle the timeout argument
in the way Stéphane described here.  The second patch then fixes
lxc-stop's handling of -W / --nowait in the normal shutdown case.

But having -W fixed, I think there's still something to clean up:

Currently (with and without my next two patches), lxc-stop implements
--nokill by setting a timeout of -1, i. e. lxc-stop waits forever.

But the man page of lxc-stop and the output of "lxc-stop --help" both
seem to imply that even with --nokill set, the timeout would apply.
If this should be the desired behaviour, lxc-stop had to be changed
once more.  Alternatively, lxcapi_shutdown() could handle the nokill
flag by itself.

Maybe it's easier to just change lxc-stop's documentation, so that it
gets clear that --nokill implies waiting forever.  I'd prefer changing
lxcapi_shutdown(), because lxc-autostart, the other command that uses
c->shutdown(), could then also use the nokill flag.

	Robert



More information about the lxc-devel mailing list