[lxc-devel] lxc-stop inconsistencies

Stéphane Graber stgraber at ubuntu.com
Thu Jan 30 16:14:39 UTC 2014


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 (vogel at users.sourceforge.net):
> > > > > 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.

> 
> 	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
> > > > lxc-devel at lists.linuxcontainers.org
> > > > http://lists.linuxcontainers.org/listinfo/lxc-devel
> > > _______________________________________________
> > > 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
> 
> 
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> _______________________________________________
> 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/20140130/ea54d84c/attachment-0001.pgp>


More information about the lxc-devel mailing list