mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
(POOLER-128) Remove references to VM mutex when destroying
This commit updates destroy_vm to remove references to its mutex tracking object when destroyed. Without this change a VM that is destroyed will leave its mutex tracking object forever causing the pool manager memory footprint to increase.
This commit is contained in:
parent
10bf6c8816
commit
490e5c1938
3 changed files with 39 additions and 0 deletions
|
|
@ -313,6 +313,7 @@ module Vmpooler
|
|||
$logger.log('s', "[-] [#{pool}] '#{vm}' destroyed in #{finish} seconds")
|
||||
$metrics.timing("destroy.#{pool}", finish)
|
||||
end
|
||||
dereference_mutex(vm)
|
||||
end
|
||||
|
||||
def purge_unused_vms_and_folders
|
||||
|
|
@ -681,6 +682,14 @@ module Vmpooler
|
|||
@vm_mutex[vmname] || @vm_mutex[vmname] = Mutex.new
|
||||
end
|
||||
|
||||
def dereference_mutex(vmname)
|
||||
if @vm_mutex.delete(vmname)
|
||||
return true
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
def sync_pool_template(pool)
|
||||
pool_template = $redis.hget('vmpooler__config__template', pool['name'])
|
||||
if pool_template
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue