mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 20:02:38 +09:00
1 parent
5e52c26374
commit
4f84b839bc
1 file changed
+17
@@ -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
|
||||
Reference in new issue
Block a user