mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Check 'failed' queue
This commit is contained in:
parent
b4828a82f5
commit
e30ef61c56
1 changed files with 41 additions and 0 deletions
|
|
@ -138,6 +138,47 @@ loop do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Check 'failed' pool
|
||||||
|
$redis.smembers('vmware_host_pool__failed__'+pool['name']).each do |vm|
|
||||||
|
if ! inventory[vm]
|
||||||
|
$redis.srem('vmware_host_pool__failed__'+pool['name'], vm)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (
|
||||||
|
(vsphere_helper.find_vms(vm)[vm]) and
|
||||||
|
(vsphere_helper.find_vms(vm)[vm].summary.guest.toolsRunningStatus == 'guestToolsRunning') and
|
||||||
|
(vsphere_helper.find_vms(vm)[vm].summary.guest.ipAddress != nil)
|
||||||
|
)
|
||||||
|
begin
|
||||||
|
Socket.getaddrinfo(vm, nil)
|
||||||
|
rescue
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
$redis.sadd('vmware_host_pool__ready__'+pool['name'], vm)
|
||||||
|
$redis.srem('vmware_host_pool__failed__'+pool['name'], vm)
|
||||||
|
|
||||||
|
logger.log('s', "[>] '#{vm}' moved to 'ready' queue")
|
||||||
|
end
|
||||||
|
|
||||||
|
if (
|
||||||
|
(vsphere_helper.find_vms(vm)[vm]) and
|
||||||
|
(vsphere_helper.find_vms(vm)[vm].runtime)
|
||||||
|
)
|
||||||
|
start = Time.now
|
||||||
|
|
||||||
|
if host.runtime.powerState == 'poweredOn'
|
||||||
|
logger.log('d', "[ ] '#{vm}' is being shut down")
|
||||||
|
host.PowerOffVM_Task.wait_for_completion
|
||||||
|
end
|
||||||
|
|
||||||
|
host.Destroy_Task.wait_for_completion
|
||||||
|
finish = '%.2f' % (Time.now-start)
|
||||||
|
|
||||||
|
logger.log('s', "[-] '#{vm}' destroyed in #{finish} seconds")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Bring the pool up to the desired size
|
# Bring the pool up to the desired size
|
||||||
if total < pool['size']
|
if total < pool['size']
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue