From bb805d71f5c76005597c6fe58206daa1b3d12766 Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Wed, 19 Feb 2014 09:38:05 -0800 Subject: [PATCH] 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 --- vmware-host-pooler | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vmware-host-pooler b/vmware-host-pooler index 0f17fcb..35da677 100755 --- a/vmware-host-pooler +++ b/vmware-host-pooler @@ -87,8 +87,6 @@ end def check_ready_vm vm, pool, ttl Thread.new { - host = $vsphere[pool].find_vm(vm) - if (ttl > 0) 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) @@ -101,10 +99,12 @@ def check_ready_vm vm, pool, ttl if ( (! 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) + host = $vsphere[pool].find_vm(vm) + if (host) if ( (host.runtime) and