(POOLER-130) Improve delta disk creation handling

This commit updates delta disk creation to reduce the likelihood of this being run more than once for any given template. Without this change an error can be generated with vsphere 6.5 or later when a template is updated, and then the update is reverted. The error prevents the image from being used because the template is never marked as prepared. To address this any failure is now logged, and the template is marked as prepared regardless of whether this was successful, or not, which allows the image to be used despite the error. This failure mode is more graceful and allows the pool to continue to function.
This commit is contained in:
kirby@puppetlabs.com 2018-08-30 15:48:50 -07:00
parent c053554ca8
commit 3fd0c6f475
3 changed files with 24 additions and 1 deletions

View file

@ -1942,6 +1942,19 @@ EOT
subject.prepare_template(config[:pools][0], provider)
end
end
context 'when template delta disk creation fails' do
before(:each) do
allow(redis).to receive(:hset)
expect(provider).to receive(:create_template_delta_disks).and_raise("MockError")
end
it 'should log a message when delta disk creation returns an error' do
expect(logger).to receive(:log).with('s', "[!] [#{pool}] failed while preparing a template with an error. As a result vmpooler could not create the template delta disks. Either a template delta disk already exists, or the template delta disk creation failed. The error is: MockError")
subject.prepare_template(config[:pools][0], provider)
end
end
end
describe 'evaluate_template' do