(POOLER-26) Fix lost VMs getting stuck in pending

This commit updates vmpooler to understand how to resolve a situation
where a pending VM does not exist. Without this change a pending VM that
does not exist in vmware inventory gets stuck in the pending state,
preventing the pool from ever reaching its target capacity.

As a part of this change the find_vm method is updated to perform a
light, then heavy search each time find_vm is called and all usage of
find_vm || find_vm_heavy is replaced. This makes find_vm usage
consistent across pool_manager.

Additionally, open_socket method is updated to resolve an incorrect
reference to the host name.
This commit is contained in:
kirby@puppetlabs.com 2016-11-16 16:33:45 -08:00
parent a6c8c76d31
commit 02327dfcd6
4 changed files with 19 additions and 18 deletions

View file

@ -40,7 +40,6 @@ describe 'Pool Manager' do
create_migrating_vm vm['name'], pool, redis
allow(vsphere).to receive(:find_vm).and_return(vm)
allow(pooler).to receive(:get_vm_host_info).and_return([{'name' => 'host1'}, 'host1'])
expect(vsphere).to receive(:find_vm).with(vm['name'])
end
it 'logs VM host when migration is disabled' do

View file

@ -26,7 +26,6 @@ describe 'Pool Manager' do
it 'calls fail_pending_vm' do
allow(vsphere).to receive(:find_vm).and_return(nil)
allow(redis).to receive(:hget)
expect(redis).to receive(:hget).with(String, 'clone').once
subject._check_pending_vm(vm, pool, timeout, vsphere)
end
end