currently the data we get from virt-who is used "on demand" by calling gethypervisorsocketfromvirtwho and gethypervisorclusterfromvirtwho, which results in quite a lot of "if/else" code.
how about we always use the data? pseudo ruby:
hypervisors_collection = []
hypervisors_list = fetch_all_results(:hosts, :index, {:search => "hypervisor=true"})
hypervisors_list.each_with_index do |system, currentcount|
sys = @api.resource(:hosts).call(:show, {:id => system['id'], :fields => 'full'})
sys = merge_sys_with_virtwodata(sys) # this is new
hypervisors_collection.push(sys)
end
def merge_sys_with_virtwhodata(sys)
cleaned_system_name = cleansatellitename(sys['name'])
rescue_hash = @parsed_hypervisors_hash[cleaned_system_name]
if rescue_hash.is_a?(Hash)
rescue_hash['facts'].each do |fact, value|
fact_name = fact.gsub('.', '::')
sys['facts'][fact_name] ||= value
end
end
return sys
end
currently the data we get from virt-who is used "on demand" by calling
gethypervisorsocketfromvirtwho
andgethypervisorclusterfromvirtwho
, which results in quite a lot of "if/else" code.how about we always use the data? pseudo ruby:
@mossicrue @Rocco83 thoughts?