mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 18:08:42 -05:00
check_ready_vm fixups
- Correct key name ('check', not 'clone')
- Correct timestamp math (minutes, not seconds)
- Only search for the host in vSphere if we're actually doing a check
This commit is contained in:
parent
bf2658cd7d
commit
bb805d71f5
1 changed files with 3 additions and 3 deletions
|
|
@ -87,8 +87,6 @@ end
|
||||||
|
|
||||||
def check_ready_vm vm, pool, ttl
|
def check_ready_vm vm, pool, ttl
|
||||||
Thread.new {
|
Thread.new {
|
||||||
host = $vsphere[pool].find_vm(vm)
|
|
||||||
|
|
||||||
if (ttl > 0)
|
if (ttl > 0)
|
||||||
if ((((Time.now - host.runtime.bootTime)/60).to_s[/^\d+\.\d{1}/].to_f) > ttl)
|
if ((((Time.now - host.runtime.bootTime)/60).to_s[/^\d+\.\d{1}/].to_f) > ttl)
|
||||||
$redis.smove('vmware_host_pool__ready__'+pool, 'vmware_host_pool__completed__'+pool, vm)
|
$redis.smove('vmware_host_pool__ready__'+pool, 'vmware_host_pool__completed__'+pool, vm)
|
||||||
|
|
@ -101,10 +99,12 @@ def check_ready_vm vm, pool, ttl
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(! check_stamp) or
|
(! check_stamp) or
|
||||||
((Time.now - Time.parse(clone_stamp)) > $config[:config]['vm_checktime'])
|
(((Time.now - Time.parse(check_stamp))/60) > $config[:config]['vm_checktime'])
|
||||||
)
|
)
|
||||||
$redis.hset('vmware_host_pool__vm__'+vm, 'check', Time.now)
|
$redis.hset('vmware_host_pool__vm__'+vm, 'check', Time.now)
|
||||||
|
|
||||||
|
host = $vsphere[pool].find_vm(vm)
|
||||||
|
|
||||||
if (host)
|
if (host)
|
||||||
if (
|
if (
|
||||||
(host.runtime) and
|
(host.runtime) and
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue