mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Handle VM not accessible during reboot (#1367)
To support commands requesting a reboot of a VM after execution, the query of ssh_info needs to avoid triggering an error when the IP address is not yet retrievable as this indicates the VM would not be reachable. Wrap the returning of the state in the driver to distinguish between the following states: - :running - indicates the machine is available - :inaccessible - the machine is running but not yet available to connect This is based on the behaviour from the virtualbox provider. Includes some rudimentary tests to exercise the driver state code. Closes: #1366
This commit is contained in:
@@ -137,7 +137,17 @@ module VagrantPlugins
|
||||
# TODO: terminated no longer appears to be a valid fog state, remove?
|
||||
return :not_created if domain.nil? || domain.state.to_sym == :terminated
|
||||
|
||||
domain.state.tr('-', '_').to_sym
|
||||
state = domain.state.tr('-', '_').to_sym
|
||||
if state == :running
|
||||
begin
|
||||
get_domain_ipaddress(machine, domain)
|
||||
rescue Fog::Errors::TimeoutError => e
|
||||
@logger.debug("Machine #{machine.id} running but no IP address available: #{e}.")
|
||||
return :inaccessible
|
||||
end
|
||||
end
|
||||
|
||||
return state
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user