mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Merge branch 'master' into dashboard
This commit is contained in:
commit
a4526ef341
1 changed files with 14 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
require 'rbvmomi'
|
||||
require 'redis'
|
||||
require 'time'
|
||||
require 'yaml'
|
||||
|
||||
$:.unshift(File.dirname(__FILE__))
|
||||
|
|
@ -306,6 +307,19 @@ def check_pool pool
|
|||
end
|
||||
end
|
||||
|
||||
# LONG-RUNNING
|
||||
$redis.hkeys('vmware_host_pool__active__'+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")
|
||||
|
||||
begin
|
||||
destroy_vm(vm, pool['name'])
|
||||
rescue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# REPOPULATE
|
||||
total = $redis.scard('vmware_host_pool__ready__'+pool['name']) +
|
||||
$redis.scard('vmware_host_pool__pending__'+pool['name'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue