mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Merge pull request #234 from mattkirby/config_issues
(POOLER-89) Identify when config issue is present
This commit is contained in:
commit
0ea1e50267
3 changed files with 16 additions and 1 deletions
|
|
@ -545,6 +545,7 @@ module Vmpooler
|
||||||
end
|
end
|
||||||
return nil if host.runtime.inMaintenanceMode
|
return nil if host.runtime.inMaintenanceMode
|
||||||
return nil unless host.overallStatus == 'green'
|
return nil unless host.overallStatus == 'green'
|
||||||
|
return nil unless host.configIssue.empty?
|
||||||
|
|
||||||
cpu_utilization = cpu_utilization_for host
|
cpu_utilization = cpu_utilization_for host
|
||||||
memory_utilization = memory_utilization_for host
|
memory_utilization = memory_utilization_for host
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,9 @@ MockHostSystem = Struct.new(
|
||||||
# From HostSystem
|
# From HostSystem
|
||||||
:capability, :config, :configManager, :datastore, :datastoreBrowser, :hardware, :network, :runtime, :summary, :systemResources, :vm,
|
:capability, :config, :configManager, :datastore, :datastoreBrowser, :hardware, :network, :runtime, :summary, :systemResources, :vm,
|
||||||
# From ManagedEntity
|
# From ManagedEntity
|
||||||
:overallStatus, :name, :parent
|
:overallStatus, :name, :parent,
|
||||||
|
# From ManagedObject
|
||||||
|
:configIssue
|
||||||
)
|
)
|
||||||
|
|
||||||
MockPropertyCollector = Struct.new(
|
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_cpu_usage] = 1 if options[:overall_cpu_usage].nil?
|
||||||
options[:overall_memory_usage] = 1 if options[:overall_memory_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[:name] = 'HOST' + rand(65536).to_s if options[:name].nil?
|
||||||
|
options[:config_issue] = [] if options[:config_issue].nil?
|
||||||
|
|
||||||
mock = MockHostSystem.new()
|
mock = MockHostSystem.new()
|
||||||
mock.name = options[:name]
|
mock.name = options[:name]
|
||||||
|
|
@ -527,6 +530,7 @@ def mock_RbVmomi_VIM_HostSystem(options = {})
|
||||||
|
|
||||||
mock.runtime.inMaintenanceMode = options[:maintenance_mode]
|
mock.runtime.inMaintenanceMode = options[:maintenance_mode]
|
||||||
mock.overallStatus = options[:overall_status]
|
mock.overallStatus = options[:overall_status]
|
||||||
|
mock.configIssue = options[:config_issue]
|
||||||
|
|
||||||
mock.summary.hardware.memorySize = options[:memory_size]
|
mock.summary.hardware.memorySize = options[:memory_size]
|
||||||
mock.hardware.memorySize = options[:memory_size]
|
mock.hardware.memorySize = options[:memory_size]
|
||||||
|
|
|
||||||
|
|
@ -1903,6 +1903,16 @@ EOT
|
||||||
end
|
end
|
||||||
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
|
# CPU utilization
|
||||||
context "host which exceeds limit in CPU utilization" do
|
context "host which exceeds limit in CPU utilization" do
|
||||||
let(:host) { mock_RbVmomi_VIM_HostSystem({
|
let(:host) { mock_RbVmomi_VIM_HostSystem({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue