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:
> > Stéphane,
> > 
> > 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:
> > > > Hi Serge,
> > > > 
> > > > On Thu, Jan 30, 2014 at 12:19:53PM +0000, Serge Hallyn wrote:
> > > > > Quoting Robert Vogelgesang ([email protected]):
> > > > > > Hi,
> > > > > > 
> > > > > > during my tests today I found some inconsistencies between the 
> > > > > > documented
> > > > > > and the actual behaviour of some lxc-stop options.
> > > > > > 
> > > > > > The documentation says that you could use --nokill to prevent 
> > > > > > hard-killing
> > > > > > the container's processes; actually you have to use --no-kill, or 
> > > > > > else
> > > > > > lxc-stop will complain.  Looking at the source, the same seems to be
> > > > > > true for --nolock; you'd have to use --no-lock instead.
> > > > > > 
> > > > > > And --nowait / -W works as documented only when used together with 
> > > > > > --reboot,
> > > > > > but using
> > > > > > 
> > > > > > # lxc-stop -n test -W
> > > > > > 
> > > > > > waits until the container has shut down.
> > > > > > 
> > > > > > What should be fixed, documentation or lxc-stop's behaviour?
> > > > > 
> > > > > I think the code should be fixed.
> > > > 
> > > > OK, I just sent a patch that changes lxc-stop to use --nokill and 
> > > > --nolock
> > > > instead of --no-kill and --no-lock.
> > > > 
> > > > For --nowait to work as documented in the shutdown case, the fix is not
> > > > so simple.  lxc-stop calls the API shutdown function - lxcapi_shutdown()
> > > > 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
> 
> 
> It looks like most of it is designed to do that, except for that retv =
> c->wait() call which will cause it to wait indefinitely.
> 
> It looks to me like we could drop that first wait() entirely and that
> should resolve the issue.

hmm, I think the real bug in lxcapi_shutdown() is this, near the top:

        if (!timeout)
                timeout = -1;

If this would get removed, the rest of lxcapi_shutdown() looks OK to me.

(Of course, lxc_stop.c has to be changed too, because it must evaluate
my_args->nowait in main(), and when my_args.nokill is set, my_args.timeout
must then be set to -1; nowait must take precedence over nokill.)

        Robert

> 
> > 
> >     Robert
> > 
> > > 
> > > > 
> > > > Either we have to change lxcapi_shutdown(), or we have to invent some
> > > > new (API ?) function for lxc-stop, that just sends the configured
> > > > haltsignal to the container.  Or am I overlooking some already existing
> > > > function that could be used for this?
> > > > 
> > > >         Robert
> > > > 
> > > > > 
> > > > > thanks,
> > > > > -serge
> > > > > _______________________________________________
> > > > > lxc-devel mailing list
> > > > > [email protected]
> > > > > http://lists.linuxcontainers.org/listinfo/lxc-devel
> > > > _______________________________________________
> > > > lxc-devel mailing list
> > > > [email protected]
> > > > http://lists.linuxcontainers.org/listinfo/lxc-devel
> > > 
> > > -- 
> > > Stéphane Graber
> > > Ubuntu developer
> > > http://www.ubuntu.com
> > 
> > 
> > > _______________________________________________
> > > lxc-devel mailing list
> > > [email protected]
> > > http://lists.linuxcontainers.org/listinfo/lxc-devel
> > _______________________________________________
> > lxc-devel mailing list
> > [email protected]
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> 
> -- 
> Stéphane Graber
> Ubuntu developer
> http://www.ubuntu.com


> _______________________________________________
> lxc-devel mailing list
> [email protected]
> http://lists.linuxcontainers.org/listinfo/lxc-devel
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to