(POOLER-89) Identify when config issue is present

This commit adds vmpooler inspection of configuration issues to host
selection. Specifically, configIssue is checked, which should allow an
issue like quickstats not being reported to be identified even when the
alarm will not trigger. Without this change a host will continue to be
used if quickstats are not reported when alarms are not triggered
because of this condition, which results in a single host being the
target for all deploys and migrations, overloading the host and causing
its VMs to have degraded performance.
This commit is contained in:
kirby@puppetlabs.com 2017-08-14 14:52:00 -07:00
parent 03e8933d2b
commit 2f5e43284d
3 changed files with 16 additions and 1 deletions

View file

@ -83,7 +83,9 @@ MockHostSystem = Struct.new(
# From HostSystem
:capability, :config, :configManager, :datastore, :datastoreBrowser, :hardware, :network, :runtime, :summary, :systemResources, :vm,
# From ManagedEntity
:overallStatus, :name, :parent
:overallStatus, :name, :parent,
# From ManagedObject
:configIssue
)
MockPropertyCollector = Struct.new(
@ -507,6 +509,7 @@ def mock_RbVmomi_VIM_HostSystem(options = {})
options[:overall_cpu_usage] = 1 if options[:overall_cpu_usage].nil?
options[:overall_memory_usage] = 1 if options[:overall_memory_usage].nil?
options[:name] = 'HOST' + rand(65536).to_s if options[:name].nil?
options[:config_issue] = [] if options[:config_issue].nil?
mock = MockHostSystem.new()
mock.name = options[:name]
@ -527,6 +530,7 @@ def mock_RbVmomi_VIM_HostSystem(options = {})
mock.runtime.inMaintenanceMode = options[:maintenance_mode]
mock.overallStatus = options[:overall_status]
mock.configIssue = options[:config_issue]
mock.summary.hardware.memorySize = options[:memory_size]
mock.hardware.memorySize = options[:memory_size]

View file

@ -1903,6 +1903,16 @@ EOT
end
end
context "host with configuration issue" do
let(:host) { mock_RbVmomi_VIM_HostSystem({
:config_issue => 'No quickstats',
})
}
it 'should return nil' do
expect(subject.get_host_utilization(host,model,limit)).to be_nil
end
end
# CPU utilization
context "host which exceeds limit in CPU utilization" do
let(:host) { mock_RbVmomi_VIM_HostSystem({