mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
(GH-185) Remove unnecessary checks in check_ready_vm
Previously in check_ready_vm, if the VM is powered off, the VM is moved in redis however the function doesn't return there, and instead then checks if the hostname is the same, and then if TCP socket 22 is open. This is unnecessary as we already know the VM is turned off so of course the hostname is wrong and TCP 22 is unavailable. The same applies for the VM hostname. This commit instead returns after it is found a VM is no longer ready. This commit also amends the spec tests for the correct behaviour.
This commit is contained in:
parent
0754f86d8c
commit
f433056734
2 changed files with 61 additions and 13 deletions
|
|
@ -102,6 +102,7 @@ module Vmpooler
|
|||
$redis.smove('vmpooler__ready__' + pool, 'vmpooler__completed__' + pool, vm)
|
||||
|
||||
$logger.log('d', "[!] [#{pool}] '#{vm}' reached end of TTL after #{ttl} minutes, removed from 'ready' queue")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -124,6 +125,7 @@ module Vmpooler
|
|||
$redis.smove('vmpooler__ready__' + pool, 'vmpooler__completed__' + pool, vm)
|
||||
|
||||
$logger.log('d', "[!] [#{pool}] '#{vm}' appears to be powered off, removed from 'ready' queue")
|
||||
return
|
||||
end
|
||||
|
||||
if
|
||||
|
|
@ -134,6 +136,7 @@ module Vmpooler
|
|||
$redis.smove('vmpooler__ready__' + pool, 'vmpooler__completed__' + pool, vm)
|
||||
|
||||
$logger.log('d', "[!] [#{pool}] '#{vm}' has mismatched hostname, removed from 'ready' queue")
|
||||
return
|
||||
end
|
||||
else
|
||||
$redis.srem('vmpooler__ready__' + pool, vm)
|
||||
|
|
@ -149,6 +152,7 @@ module Vmpooler
|
|||
else
|
||||
$logger.log('d', "[!] [#{pool}] '#{vm}' is unreachable, and failed to remove from 'ready' queue")
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue