mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
Send shutdown command to VMs on poweroff
(cherry picked from commit ac2a920831c0964f5a18422732b50387b4c4f8ad)
This commit is contained in:
parent
2757bf8168
commit
7df7f4ff73
@ -1617,10 +1617,20 @@ class VCenterVm
|
||||
case lcm_state
|
||||
when "SHUTDOWN"
|
||||
begin
|
||||
vm.ShutdownGuest.wait_for_completion
|
||||
vm.ShutdownGuest
|
||||
counter = 60*10 # 10 minutes
|
||||
while counter > 0
|
||||
break if vm.runtime.powerState == "poweredOff"
|
||||
counter -= 1
|
||||
sleep 1
|
||||
end
|
||||
rescue
|
||||
end
|
||||
vm.PowerOffVM_Task.wait_for_completion
|
||||
|
||||
if vm.runtime.powerState != "poweredOff"
|
||||
vm.PowerOffVM_Task.wait_for_completion
|
||||
end
|
||||
|
||||
if keep_disks
|
||||
detach_all_disks(vm)
|
||||
else
|
||||
@ -1656,10 +1666,19 @@ class VCenterVm
|
||||
|
||||
when "SHUTDOWN_POWEROFF", "SHUTDOWN_UNDEPLOY"
|
||||
begin
|
||||
vm.ShutdownGuest.wait_for_completion
|
||||
vm.ShutdownGuest
|
||||
counter = 60*10 # 10 minutes
|
||||
while counter > 0
|
||||
break if vm.runtime.powerState == "poweredOff"
|
||||
counter -= 1
|
||||
sleep 1
|
||||
end
|
||||
rescue
|
||||
end
|
||||
vm.PowerOffVM_Task.wait_for_completion
|
||||
|
||||
if vm.runtime.powerState != "poweredOff"
|
||||
vm.PowerOffVM_Task.wait_for_completion
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user