mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Fixing method remove_excess_vms
Before this fix, if the pool had an excessive number of 'pending' vms, but was not full of 'ready' vms, we would end up clearing all the 'pending' vms regardless, which could bring us back under the max pool size. This fix makes sure we only remove the excess, see unit test for an example
This commit is contained in:
parent
045a85183f
commit
d95e486c8c
2 changed files with 14 additions and 1 deletions
|
|
@ -631,8 +631,10 @@ module Vmpooler
|
|||
move_vm_queue(pool['name'], next_vm, 'ready', 'completed')
|
||||
end
|
||||
if total > ready
|
||||
$redis.smembers("vmpooler__pending__#{pool['name']}").each do |vm|
|
||||
max_to_remove = total - pool['size']
|
||||
$redis.smembers("vmpooler__pending__#{pool['name']}").each_with_index do |vm, i|
|
||||
move_vm_queue(pool['name'], vm, 'pending', 'completed')
|
||||
if max_to_remove == (i+1) then break end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue