'vm_checktime' sets interval for check_ready_vm

This commit is contained in:
Scott Schneider 2014-02-18 22:48:22 -08:00
parent 1e6ca05d14
commit 62cbc5a6ff

View file

@ -33,6 +33,7 @@ end
# Set some defaults # Set some defaults
$config[:config]['task_limit'] ||= 10 $config[:config]['task_limit'] ||= 10
$config[:config]['vm_checktime'] ||= 15
$config[:config]['vm_lifetime'] ||= 24 $config[:config]['vm_lifetime'] ||= 24
$config[:redis] ||= Hash.new $config[:redis] ||= Hash.new
$config[:redis]['server'] ||= 'localhost' $config[:redis]['server'] ||= 'localhost'
@ -96,6 +97,14 @@ def check_ready_vm vm, pool, ttl
end end
end end
check_stamp = $redis.hget('vmware_host_pool__vm__'+vm, 'check')
if (
(! check_stamp) or
((Time.now - Time.parse(clone_stamp)) > $config[:config]['vm_checktime'])
)
$redis.hset('vmware_host_pool__vm__'+vm, 'check', Time.now)
if (host) if (host)
if ( if (
(host.runtime) and (host.runtime) and
@ -121,6 +130,7 @@ def check_ready_vm vm, pool, ttl
$logger.log('d', "[!] [#{pool}] '#{vm}' is unreachable, removed from 'ready' queue") $logger.log('d', "[!] [#{pool}] '#{vm}' is unreachable, removed from 'ready' queue")
end end
end end
end
} }
end end