mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Fix up tests to pass with additions
This commit is contained in:
parent
ddecb8b8d0
commit
c8426b0076
2 changed files with 34 additions and 22 deletions
|
|
@ -617,18 +617,20 @@ module Vmpooler
|
|||
end
|
||||
|
||||
def remove_excess_vms(pool, provider, ready, total)
|
||||
unless total == 0
|
||||
mutex = @reconfigure_pool[pool['name']] || @reconfigure_pool[pool['name']] = Mutex.new
|
||||
mutex.synchronize do
|
||||
if total > pool['size']
|
||||
difference = ready - pool['size']
|
||||
difference.times do
|
||||
next_vm = $redis.spop("vmpooler__ready__#{pool['name']}")
|
||||
move_vm_queue(pool['name'], next_vm, 'ready', 'completed')
|
||||
end
|
||||
if total > ready
|
||||
$redis.smembers("vmpooler__pending__#{pool['name']}").each do |vm|
|
||||
move_vm_queue(pool['name'], vm, 'pending', 'completed')
|
||||
if total
|
||||
unless total == 0
|
||||
mutex = @reconfigure_pool[pool['name']] || @reconfigure_pool[pool['name']] = Mutex.new
|
||||
mutex.synchronize do
|
||||
if total > pool['size']
|
||||
difference = ready - pool['size']
|
||||
difference.times do
|
||||
next_vm = $redis.spop("vmpooler__ready__#{pool['name']}")
|
||||
move_vm_queue(pool['name'], next_vm, 'ready', 'completed')
|
||||
end
|
||||
if total > ready
|
||||
$redis.smembers("vmpooler__pending__#{pool['name']}").each do |vm|
|
||||
move_vm_queue(pool['name'], vm, 'pending', 'completed')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue