[lxc-devel] [Q] different from behavior of lxc-stop and description of man page
Serge Hallyn
serge.hallyn at ubuntu.com
Mon Dec 23 16:26:38 UTC 2013
Quoting Serge Hallyn (serge.hallyn at ubuntu.com):
> Quoting KATOH Yasufumi (karma at jazz.email.ne.jp):
> > Hi,
> >
> > When I translated lxc-stop(1) into Japanese, I had a question.
> >
> > When -s option is specified, according to the man page,
> > > Only request a clean shutdown, do not kill the container tasks if
> > > the clean shutdown fails.
> >
> > I thought this means that even if lxc-stop -s fails shutdown, it does
> > not kill the container. But at this time, "lxc-stop -s" calls
> > c->stop(), then the container is killed, if timeout > 0.
> >
> > Is the man page wrong? Or I mistake?
>
> Hm, the default appears to be a timeout of 60 seconds before we
> hard kill the container, so yes the manpage should be updated to reflect
> that.
I've pushed the following patch to line up the docs and the code.
>From 25070b660187b61aa4e969db01b55d1360639543 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge.hallyn at ubuntu.com>
Date: Mon, 23 Dec 2013 10:23:38 -0600
Subject: [PATCH 1/1] lxc-stop: don't set timeout if user requested -s
A timeout means wait this long before killing the container.
-s means don't kill the container. timeout defaults to 60
seconds. So if a shutdown is requested, then set timeout to
0.
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
doc/lxc-stop.sgml.in | 3 +--
src/lxc/lxc_stop.c | 3 +++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/doc/lxc-stop.sgml.in b/doc/lxc-stop.sgml.in
index d4ec36a..09ea5d6 100644
--- a/doc/lxc-stop.sgml.in
+++ b/doc/lxc-stop.sgml.in
@@ -151,8 +151,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</term>
<listitem>
<para>
- Wait TIMEOUT seconds before hard-stopping the container of (in
- the reboot case) returning failure.
+ Wait TIMEOUT seconds before hard-stopping the container.
</para>
</listitem>
</varlistentry>
diff --git a/src/lxc/lxc_stop.c b/src/lxc/lxc_stop.c
index a4ead81..7940053 100644
--- a/src/lxc/lxc_stop.c
+++ b/src/lxc/lxc_stop.c
@@ -175,6 +175,9 @@ int main(int argc, char *argv[])
goto out;
}
+ if (my_args.shutdown)
+ my_args.timeout = 0;
+
s = c->shutdown(c, my_args.timeout);
if (!s) {
if (!my_args.shutdown)
--
1.8.5.2
More information about the lxc-devel
mailing list