Merge pull request #271 from mattkirby/less_delta_disks

Ensure template deltas are created once
This commit is contained in:
mchllweeks 2018-07-09 12:49:08 -07:00 committed by GitHub
commit 2f98b1bd7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 4 deletions

View file

@ -630,6 +630,13 @@ module Vmpooler
prepare_template(pool, provider)
prepared_template = $redis.hget('vmpooler__template__prepared', pool['name'])
end
elsif prepared_template != pool['template']
if configured_template.nil?
mutex.synchronize do
prepare_template(pool, provider)
prepared_template = $redis.hget('vmpooler__template__prepared', pool['name'])
end
end
end
return if configured_template.nil?
return if configured_template == prepared_template
@ -901,8 +908,6 @@ module Vmpooler
$redis.set('vmpooler__tasks__clone', 0)
# Clear out vmpooler__migrations since stale entries may be left after a restart
$redis.del('vmpooler__migration')
# Ensure template deltas are created on each startup
$redis.del('vmpooler__template__prepared')
# Copy vSphere settings to correct location. This happens with older configuration files
if !$config[:vsphere].nil? && ($config[:providers].nil? || $config[:providers][:vsphere].nil?)