(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:
kirby@puppetlabs.com 2018-07-23 15:58:09 -07:00
parent 10bf6c8816
commit 490e5c1938
3 changed files with 39 additions and 0 deletions

View file

@ -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