core: if can't communicate, force halt right away
This commit is contained in:
parent
8bb0094113
commit
4c070a04d2
|
@ -44,23 +44,23 @@ module Vagrant
|
||||||
# Only attempt to perform graceful shutdown under certain cases
|
# Only attempt to perform graceful shutdown under certain cases
|
||||||
# checked above.
|
# checked above.
|
||||||
if graceful
|
if graceful
|
||||||
env[:ui].info I18n.t("vagrant.actions.vm.halt.graceful")
|
env[:ui].output(I18n.t("vagrant.actions.vm.halt.graceful"))
|
||||||
|
|
||||||
begin
|
begin
|
||||||
env[:machine].guest.capability(:halt)
|
env[:machine].guest.capability(:halt)
|
||||||
rescue Errors::MachineGuestNotReady
|
|
||||||
@logger.info("Machine guest not ready while attempting to halt. Ignoring.")
|
|
||||||
end
|
|
||||||
|
|
||||||
@logger.debug("Waiting for target graceful halt state: #{@target_state}")
|
@logger.debug("Waiting for target graceful halt state: #{@target_state}")
|
||||||
begin
|
begin
|
||||||
Timeout.timeout(env[:machine].config.vm.graceful_halt_timeout) do
|
Timeout.timeout(env[:machine].config.vm.graceful_halt_timeout) do
|
||||||
while env[:machine].state.id != @target_state
|
while env[:machine].state.id != @target_state
|
||||||
sleep 1
|
sleep 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
rescue Timeout::Error
|
||||||
|
# Don't worry about it, we catch the case later.
|
||||||
end
|
end
|
||||||
rescue Timeout::Error
|
rescue Errors::MachineGuestNotReady
|
||||||
# Don't worry about it, we catch the case later.
|
env[:ui].detail(I18n.t("vagrant.actions.vm.halt.guest_not_ready"))
|
||||||
end
|
end
|
||||||
|
|
||||||
# The result of this matters on whether we reached our
|
# The result of this matters on whether we reached our
|
||||||
|
|
|
@ -1312,6 +1312,11 @@ en:
|
||||||
Forcing shutdown of VM...
|
Forcing shutdown of VM...
|
||||||
graceful: |-
|
graceful: |-
|
||||||
Attempting graceful shutdown of VM...
|
Attempting graceful shutdown of VM...
|
||||||
|
guest_not_ready: |-
|
||||||
|
Guest communication could not be established! This is usually because
|
||||||
|
SSH is not running, the authentication information was changed,
|
||||||
|
or some other networking issue. Vagrant will force halt, if
|
||||||
|
capable.
|
||||||
hostname:
|
hostname:
|
||||||
setting: "Setting hostname..."
|
setting: "Setting hostname..."
|
||||||
import:
|
import:
|
||||||
|
|
Loading…
Reference in New Issue