mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-08 21:16:39 +09:00
Add shutdown wait for VMware
This commit is contained in:
1 parent
16003fb2f4
commit
d0be26fac3
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