[lxc-devel] [PATCH] Make get_ips timeout poll configurable

Stéphane Graber stgraber at ubuntu.com
Mon Jul 8 17:56:06 UTC 2013


On Mon, Jul 08, 2013 at 10:26:09AM -0700, John McFarlane wrote:
> Locally I find 5 seconds to be inadequate to reliably obtain the ip
> address of a container.  This commit only adds an option, a subsequent
> commit could increase the default (5) if that seems reasonable.
> 
> Signed-off-by: John McFarlane <john at rockfloat.com>
> ---
>  src/lxc/lxc-start-ephemeral.in | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/lxc-start-ephemeral.in b/src/lxc/lxc-start-ephemeral.in
> index cb1f732..6123259 100644
> --- a/src/lxc/lxc-start-ephemeral.in
> +++ b/src/lxc/lxc-start-ephemeral.in
> @@ -97,6 +97,9 @@ parser.add_argument("--union-type", "-U", type=str, default="overlayfs",
>  parser.add_argument("--keep-data", "-k", action="store_true",
>                      help=_("don't wipe everything clean at the end"))
>  
> +parser.add_argument("--get-ips-timeout", "-I", type=int, default=5,
> +                    help=_("the timeout to use when polling get_ips"))
> +
>  parser.add_argument("command", metavar='CMD', type=str, nargs="*",
>                      help=_("Run specific command in container "
>                             "(command as argument)"))
> @@ -273,7 +276,7 @@ if not args.command and not args.daemon:
>      sys.exit(0)
>  
>  # Try to get the IP addresses
> -ips = dest.get_ips(timeout=5)
> +ips = dest.get_ips(timeout=args.get_ips_timeout)
>  
>  # Deal with the case where we just print info about the container
>  if args.daemon:

Hi,

I'd be happy to have this increased to 10s by default upstream, I only
put it at 5s in my previous commit because that was our old default
value.

I'd prefer not to add --get-ips-timeout as this sounds like a
workaround/debug option and I'd like to keep the option list relatively
short. However, I'd be happy to use a LXC_IP_TIMEOUT environment
variable for this which would be used by get_ips when timeout isn't set
and by lxc-start-ephemeral as a way to override the default timeout of
10s.

-- 
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: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130708/79983223/attachment.pgp>


More information about the lxc-devel mailing list