From 2d63603d85bd844d6bb9957e522f6f06f9e26689 Mon Sep 17 00:00:00 2001 From: Hugo Fonseca Date: Mon, 7 Nov 2016 15:34:48 +0000 Subject: [PATCH 1/3] Increase the re-tries amount --- lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb b/lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb index 5b36c18..25baa7b 100644 --- a/lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb +++ b/lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb @@ -21,7 +21,7 @@ module Vagrant def assigned_ip(env) driver = env[:machine].provider.driver ip = '' - retryable(:on => LXC::Errors::ExecuteError, :tries => 10, :sleep => 3) do + retryable(:on => LXC::Errors::ExecuteError, :tries => 20, :sleep => 3) do unless ip = get_container_ip_from_ip_addr(driver) # retry raise LXC::Errors::ExecuteError, :command => "lxc-attach" From cac4910296911fc19ebefa9d16a8a306cd95295d Mon Sep 17 00:00:00 2001 From: Hugo Fonseca Date: Wed, 9 Nov 2016 14:38:05 +0000 Subject: [PATCH 2/3] tries amount of fetching ip is now configurable --- lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb | 4 +++- lib/vagrant-lxc/config.rb | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb b/lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb index 25baa7b..0e5d28f 100644 --- a/lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb +++ b/lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb @@ -19,9 +19,11 @@ module Vagrant end def assigned_ip(env) + config = env[:machine].provider_config + fetch_ip_tries = config.fetch_ip_tries driver = env[:machine].provider.driver ip = '' - retryable(:on => LXC::Errors::ExecuteError, :tries => 20, :sleep => 3) do + retryable(:on => LXC::Errors::ExecuteError, :tries => fetch_ip_tries, :sleep => 3) do unless ip = get_container_ip_from_ip_addr(driver) # retry raise LXC::Errors::ExecuteError, :command => "lxc-attach" diff --git a/lib/vagrant-lxc/config.rb b/lib/vagrant-lxc/config.rb index e727f9f..b6b5da3 100644 --- a/lib/vagrant-lxc/config.rb +++ b/lib/vagrant-lxc/config.rb @@ -18,12 +18,15 @@ module Vagrant # machine name, set this to :machine attr_accessor :container_name + attr_accessor :fetch_ip_tries + def initialize @customizations = [] @backingstore = UNSET_VALUE @backingstore_options = [] @sudo_wrapper = UNSET_VALUE @container_name = UNSET_VALUE + @fetch_ip_tries = 10 end # Customize the container by calling `lxc-start` with the given From 6d8580a294c6ec877722fef2e273250940a0fbbf Mon Sep 17 00:00:00 2001 From: Hugo Fonseca Date: Fri, 11 Nov 2016 08:34:42 +0000 Subject: [PATCH 3/3] default values goes to finalize --- lib/vagrant-lxc/config.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-lxc/config.rb b/lib/vagrant-lxc/config.rb index b6b5da3..6593dca 100644 --- a/lib/vagrant-lxc/config.rb +++ b/lib/vagrant-lxc/config.rb @@ -26,7 +26,7 @@ module Vagrant @backingstore_options = [] @sudo_wrapper = UNSET_VALUE @container_name = UNSET_VALUE - @fetch_ip_tries = 10 + @fetch_ip_tries = UNSET_VALUE end # Customize the container by calling `lxc-start` with the given @@ -54,6 +54,7 @@ module Vagrant @container_name = nil if @container_name == UNSET_VALUE @backingstore = "best" if @backingstore == UNSET_VALUE @existing_container_name = nil if @existing_container_name == UNSET_VALUE + @fetch_ip_tries = 10 if @fetch_ip_tries == UNSET_VALUE end end end