mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Add shutdown wait for VMware
(cherry picked from commit d0be26fac3eb9cd5dcb708efaa4a7c8154ff5078)
This commit is contained in:
parent
5e52c26374
commit
4f84b839bc
@ -29,9 +29,26 @@ $: << File.dirname(__FILE__)
|
||||
|
||||
require 'vmware_driver'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Wait the VM to shutdown TIMEOUT (xPOLL_INTERVAL) seconds.
|
||||
# Set to ~10min
|
||||
#------------------------------------------------------------------------------
|
||||
POLL_INTERVAL=2
|
||||
TIMEOUT=300
|
||||
|
||||
deploy_id = ARGV[0]
|
||||
host = ARGV[1]
|
||||
|
||||
vmware_drv = VMwareDriver.new(host)
|
||||
|
||||
vmware_drv.shutdown(deploy_id)
|
||||
|
||||
count=0
|
||||
while (vmware_drv.poll(deploy_id).match(/STATE=(.*)/)[1] != "d") do
|
||||
sleep POLL_INTERVAL
|
||||
if count > TIMEOUT then
|
||||
OpenNebula.log_debug("Timeout reached and VM #{deploy_id} is still alive.")
|
||||
exit -1
|
||||
end
|
||||
count+=POLL_INTERVAL
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user