Fail fast if the VM fails to boot properly. [GH-825]

This commit is contained in:
Mitchell Hashimoto 2012-03-25 10:00:27 -07:00
parent 1b4388ee98
commit bfe20a223f
4 changed files with 17 additions and 0 deletions

View File

@ -17,6 +17,8 @@
that are potentially listening on that port as well. [GH-821] that are potentially listening on that port as well. [GH-821]
- Multiple VM names can be specified for the various commands now. For - Multiple VM names can be specified for the various commands now. For
example: `vagrant up web db service`. [GH-795] example: `vagrant up web db service`. [GH-795]
- More robust error handling if a VM fails to boot. The error message
is much clearer now. [GH-825]
## 1.0.1 (March 11, 2012) ## 1.0.1 (March 11, 2012)

View File

@ -35,6 +35,11 @@ module Vagrant
# get shown # get shown
return true if @env[:interrupted] return true if @env[:interrupted]
# If the VM is not starting or running, something went wrong
# and we need to show a useful error.
state = @env[:vm].state
raise Errors::VMFailedToRun if state != :starting && state != :running
sleep 2 if !@env["vagrant.test"] sleep 2 if !@env["vagrant.test"]
end end

View File

@ -393,6 +393,11 @@ module Vagrant
error_key(:failed_to_boot, "vagrant.actions.vm.boot") error_key(:failed_to_boot, "vagrant.actions.vm.boot")
end end
class VMFailedToRun < VagrantError
status_code(77)
error_key(:failed_to_run, "vagrant.actions.vm.boot")
end
class VMGuestError < VagrantError class VMGuestError < VagrantError
status_code(39) status_code(39)
error_namespace("vagrant.errors.guest") error_namespace("vagrant.errors.guest")

View File

@ -331,6 +331,11 @@ en:
failed_to_boot: |- failed_to_boot: |-
Failed to connect to VM via SSH. Please verify the VM successfully booted Failed to connect to VM via SSH. Please verify the VM successfully booted
by looking at the VirtualBox GUI. by looking at the VirtualBox GUI.
failed_to_run: |-
The VM failed to remain in the "running" state while attempting to boot.
This is normally caused by a misconfiguration or host system incompatibilities.
Please open the VirtualBox GUI and attempt to boot the virtual machine
manually to get a more informative error message.
bridged_networking: bridged_networking:
available: |- available: |-
Available bridged network interfaces: Available bridged network interfaces: