(POOLER-70) Update fail_pending_vm for VM Provider

Previously the Pool Manager would use vSphere objects directly.  This commit
- Modifies the pool_manager to use the VM provider methods instead
- Modified to return true or false to indicate that the VM was failed
This commit is contained in:
Glenn Sarti 2017-03-31 13:42:09 -07:00
parent 199bf4a070
commit 9f4fc903b9
2 changed files with 10 additions and 8 deletions

View file

@ -50,9 +50,9 @@ module Vmpooler
$logger.log('d', "[!] [#{pool}] '#{vm}' no longer exists. Removing from pending.")
end
def fail_pending_vm(vm, pool, timeout, exists=true)
def fail_pending_vm(vm, pool, timeout, exists = true)
clone_stamp = $redis.hget("vmpooler__vm__#{vm}", 'clone')
return if ! clone_stamp
return true if !clone_stamp
time_since_clone = (Time.now - Time.parse(clone_stamp)) / 60
if time_since_clone > timeout
@ -63,8 +63,10 @@ module Vmpooler
remove_nonexistent_vm(vm, pool)
end
end
true
rescue => err
$logger.log('d', "Fail pending VM failed with an error: #{err}")
false
end
def move_pending_vm_to_ready(vm, pool, host)