providers/virtualbox: retry suspended check [GH-2479]

This commit is contained in:
Mitchell Hashimoto 2013-11-23 11:20:00 -08:00
parent d554cfc4e0
commit c00b045f53
5 changed files with 55 additions and 4 deletions

View File

@ -22,6 +22,8 @@ BUG FIXES:
- guests/ubuntu: "localhost" is preserved when changing hostnames.
[GH-2383]
- hosts/gentoo: Support systemd for NFS startup. [GH-2382]
- providers/virtualbox: Don't start new VM if VirtualBox has transient
failure during `up` from suspended. [GH-2479]
- provisioners/salt: Bootstrap on FreeBSD systems work. [GH-2525]
## 1.3.5 (October 15, 2013)

View File

@ -63,7 +63,8 @@ module VagrantPlugins
if !driver_klass
supported_versions = driver_map.keys.sort.join(", ")
raise Vagrant::Errors::VirtualBoxInvalidVersion, :supported_versions => supported_versions
raise Vagrant::Errors::VirtualBoxInvalidVersion,
supported_versions: supported_versions
end
@logger.info("Using VirtualBox driver: #{driver_klass}")

View File

@ -482,7 +482,23 @@ module VagrantPlugins
end
def vm_exists?(uuid)
raw("showvminfo", uuid).exit_code == 0
5.times do |i|
result = raw("showvminfo", uuid)
return true if result.exit_code == 0
# GH-2479: Sometimes this happens. In this case, retry. If
# we don't see this text, the VM really probably doesn't exist.
return false if !result.stderr.include?("CO_E_SERVER_EXEC_FAILURE")
# Sleep a bit though to give VirtualBox time to fix itself
sleep 2
end
# If we reach this point, it means that we consistently got the
# failure, do a standard vboxmanage now. This will raise an
# exception if it fails again.
execute("showvminfo", uuid)
return true
end
end
end

View File

@ -491,7 +491,23 @@ module VagrantPlugins
end
def vm_exists?(uuid)
raw("showvminfo", uuid).exit_code == 0
5.times do |i|
result = raw("showvminfo", uuid)
return true if result.exit_code == 0
# GH-2479: Sometimes this happens. In this case, retry. If
# we don't see this text, the VM really probably doesn't exist.
return false if !result.stderr.include?("CO_E_SERVER_EXEC_FAILURE")
# Sleep a bit though to give VirtualBox time to fix itself
sleep 2
end
# If we reach this point, it means that we consistently got the
# failure, do a standard vboxmanage now. This will raise an
# exception if it fails again.
execute("showvminfo", uuid)
return true
end
end
end

View File

@ -491,7 +491,23 @@ module VagrantPlugins
end
def vm_exists?(uuid)
raw("showvminfo", uuid).exit_code == 0
5.times do |i|
result = raw("showvminfo", uuid)
return true if result.exit_code == 0
# GH-2479: Sometimes this happens. In this case, retry. If
# we don't see this text, the VM really probably doesn't exist.
return false if !result.stderr.include?("CO_E_SERVER_EXEC_FAILURE")
# Sleep a bit though to give VirtualBox time to fix itself
sleep 2
end
# If we reach this point, it means that we consistently got the
# failure, do a standard vboxmanage now. This will raise an
# exception if it fails again.
execute("showvminfo", uuid)
return true
end
end
end