1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #2339 from nirvdrum/improve_vsphere_shutdown

Improve vsphere shutdown
This commit is contained in:
Kevin Menard 2013-11-05 10:21:40 -08:00
commit d3e4c4ffbd

View file

@ -88,7 +88,7 @@ module Fog
end end
def stop(options = {}) def stop(options = {})
options = { :force => !tools_installed? }.merge(options) options = { :force => !tools_installed? || !tools_running? }.merge(options)
requires :instance_uuid requires :instance_uuid
service.vm_power_off('instance_uuid' => instance_uuid, 'force' => options[:force]) service.vm_power_off('instance_uuid' => instance_uuid, 'force' => options[:force])
end end
@ -103,7 +103,7 @@ module Fog
requires :instance_uuid requires :instance_uuid
if ready? if ready?
# need to turn it off before destroying # need to turn it off before destroying
stop stop(options)
wait_for { !ready? } wait_for { !ready? }
end end
service.vm_destroy('instance_uuid' => instance_uuid) service.vm_destroy('instance_uuid' => instance_uuid)
@ -155,6 +155,10 @@ module Fog
tools_state != "toolsNotInstalled" tools_state != "toolsNotInstalled"
end end
def tools_running?
tools_state == "toolsOk"
end
# defines VNC attributes on the hypervisor # defines VNC attributes on the hypervisor
def config_vnc(options = {}) def config_vnc(options = {})
requires :instance_uuid requires :instance_uuid