1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Resolved bug vm state

This commit is contained in:
jagarrigo 2018-07-18 12:04:24 +02:00 committed by Tino Vázquez
parent a3f8a05228
commit 32c7df8d03
2 changed files with 15 additions and 0 deletions

View File

@ -66,6 +66,9 @@ begin
vm.reconfigure
vm.poweron
wait_deploy_timeout(vm)
vm.set_running(true)
vm.one_item.update("VCENTER_ESX_HOST = #{vm['runtime.host.name']}", true)

View File

@ -93,3 +93,15 @@ def check_item(item, target_class)
raise "Reference \"#{item._ref}\" error. The reference does not exist"
end
end
def wait_deploy_timeout(vm, timeout_deploy = 300)
time_start = Time.now
begin
time_running = Time.now - time_start
if time_running.to_i >= timeout_deploy
raise "reached deploy timeout"
end
sleep(2)
state = vm.item.summary.runtime.powerState
end until(state == "poweredOn")
end