Don't deploy VMs to not-good hypervisors

This implements a check to ensure that the VMware host being deployed to
is in a sane ('green') state.
This commit is contained in:
Scott Schneider 2014-09-04 11:57:01 -07:00
parent 36fffa381f
commit ba5e713902

View file

@ -65,10 +65,12 @@ module Vmpooler
datacenter.hostFolder.children.each do |folder| datacenter.hostFolder.children.each do |folder|
next unless folder.name == cluster next unless folder.name == cluster
folder.host.each do |host| folder.host.each do |host|
if host.overallStatus == 'green'
hosts[host.name] = host hosts[host.name] = host
hosts_sort[host.name] = host.vm.length hosts_sort[host.name] = host.vm.length
end end
end end
end
hosts[hosts_sort.sort_by { |k,v| v }[0][0]] hosts[hosts_sort.sort_by { |k,v| v }[0][0]]
end end