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:
commit
d3e4c4ffbd
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue