mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Fixup for long-running destruction
This commit is contained in:
parent
9675981927
commit
3c42155c18
1 changed files with 3 additions and 6 deletions
|
|
@ -308,15 +308,12 @@ def check_pool pool
|
|||
end
|
||||
|
||||
# LONG-RUNNING
|
||||
$redis.hkeys('vmware_host_pool__active__'+pool['name']).each do |vm|
|
||||
$redis.smembers('vmware_host_pool__running__'+pool['name']).each do |vm|
|
||||
running = (Time.now - Time.parse($redis.hget('vmware_host_pool__active__'+pool['name'], vm)))/60/60
|
||||
if (running > 12)
|
||||
$logger.log('d', "[!] [#{pool}] '#{vm}' reached end of TTL after 12 hours")
|
||||
$redis.smove('vmware_host_pool__running__'+pool['name'], 'vmware_host_pool__completed__'+pool['name'], vm)
|
||||
|
||||
begin
|
||||
destroy_vm(vm, pool['name'])
|
||||
rescue
|
||||
end
|
||||
$logger.log('d', "[!] [#{pool['name']}] '#{vm}' reached end of TTL after 12 hours")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue