mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Identify when ESXi host quickstats do not return
This commit updates cpu_utilization_for and memory_utilization_for to detect when quickstats are not present. Without this change a nil result is transformed to 0, which is perceived as a host that has no utilization.
This commit is contained in:
parent
6ab2e2ff8c
commit
ea9deddd2d
2 changed files with 25 additions and 2 deletions
|
|
@ -1772,6 +1772,24 @@ EOT
|
|||
expect(subject.get_host_utilization(host,model,limit)[1]).to eq(host)
|
||||
end
|
||||
end
|
||||
|
||||
context 'host with no quickstats' do
|
||||
let(:host) { mock_RbVmomi_VIM_HostSystem({
|
||||
:cpu_speed => 100,
|
||||
:num_cores_per_cpu => 1,
|
||||
:num_cpu => 1,
|
||||
:memory_size => 100.0 * 1024 * 1024
|
||||
})
|
||||
}
|
||||
before(:each) do
|
||||
host.summary.quickStats.overallCpuUsage = nil
|
||||
end
|
||||
|
||||
it 'should return nil' do
|
||||
result = subject.get_host_utilization(host,model,limit)
|
||||
expect(result).to be nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#host_has_cpu_model?' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue