mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-27 02:18:41 -05:00
Only check hostname for mismatch after time since ready has past
Configure hostname checking so it is not checked until a VM has been ready for greater than one minute. Without this change hostname checking will often fail because the configured value has not propogated to the VM on some platforms before this check is run.
This commit is contained in:
parent
6810cbe78e
commit
c6020e922c
2 changed files with 26 additions and 6 deletions
|
|
@ -197,7 +197,7 @@ EOT
|
|||
redis.hset("vmpooler__vm__#{vm}", 'clone',Time.now.to_s)
|
||||
expect(metrics).to receive(:timing).with(/time_to_ready_state\./,/0/)
|
||||
|
||||
subject.move_pending_vm_to_ready(vm, pool, host)
|
||||
subject.move_pending_vm_to_ready(vm, pool)
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -329,13 +329,22 @@ EOT
|
|||
end
|
||||
|
||||
context 'with hostname mismatch checking enabled' do
|
||||
before(:each) do
|
||||
expect(provider).to receive(:get_vm).with(pool,vm).and_return(host)
|
||||
|
||||
context 'when less than 60 seconds since a VM moved to ready' do
|
||||
before(:each) do
|
||||
redis.hset("vmpooler__vm__#{vm}", 'ready', Time.now)
|
||||
end
|
||||
|
||||
it 'should return nil' do
|
||||
expect(subject._check_ready_vm(vm, poolconfig, ttl, provider)).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a hostname mismatch' do
|
||||
let(:different_hostname) { 'different_name' }
|
||||
before(:each) do
|
||||
host['hostname'] = 'different_name'
|
||||
expect(provider).to receive(:get_vm).with(pool,vm).and_return(host)
|
||||
host['hostname'] = different_hostname
|
||||
end
|
||||
|
||||
it 'should move the VM to the completed queue' do
|
||||
|
|
@ -353,7 +362,7 @@ EOT
|
|||
end
|
||||
|
||||
it 'should log messages about being misnamed' do
|
||||
expect(logger).to receive(:log).with('d', "[!] [#{pool}] '#{vm}' has mismatched hostname, removed from 'ready' queue")
|
||||
expect(logger).to receive(:log).with('d', "[!] [#{pool}] '#{vm}' has mismatched hostname #{different_hostname}, removed from 'ready' queue")
|
||||
|
||||
subject._check_ready_vm(vm, poolconfig, ttl, provider)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue