X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/309ee76ad791b526fc8147dc2905f3f5ee67a053..3c1bde934978cdea59a815f4601cb23cd7bd5636:/cookbooks/hardware/templates/default/ohai.rb.erb diff --git a/cookbooks/hardware/templates/default/ohai.rb.erb b/cookbooks/hardware/templates/default/ohai.rb.erb index 6fe38642e..23965c8bd 100644 --- a/cookbooks/hardware/templates/default/ohai.rb.erb +++ b/cookbooks/hardware/templates/default/ohai.rb.erb @@ -148,7 +148,7 @@ Ohai.plugin(:Hardware) do find_direct_disks(disk) find_nvme_disks(disk) - find_hp_disks(disk) if File.exist?("/usr/sbin/hpssacli") + find_hp_disks(disk) if File.exist?("/usr/sbin/ssacli") find_megaraid_disks(disk) if File.exist?("/usr/sbin/megacli") find_mpt1_disks(disk) if File.exist?("/usr/sbin/lsiutil") find_mpt2_disks(disk) if File.exist?("/usr/sbin/sas2ircu") @@ -158,7 +158,7 @@ Ohai.plugin(:Hardware) do find_md_arrays(disk) disk[:disks].each do |disk| - if disk[:vendor] =~ /^CVPR/ && disk[:model] == "INTEL" + if disk[:vendor] =~ /^(BTWA|CVPR|PHDV)/ && disk[:model] == "INTEL" disk[:model] = disk[:serial_number] disk[:serial_number] = disk[:vendor] disk[:vendor] = "INTEL" @@ -286,7 +286,7 @@ Ohai.plugin(:Hardware) do array = nil disk = nil - IO.popen(%w(hpssacli controller all show config detail)).each do |line| + IO.popen(%w(ssacli controller all show config detail)).each do |line| if line =~ /^Smart Array (\S+) / controller = { :id => devices[:controllers].count, @@ -525,8 +525,7 @@ Ohai.plugin(:Hardware) do :controller => controller[:id], :vendor => Regexp.last_match(4), :model => Regexp.last_match(5), - :bus => Regexp.last_match(1), - :target => Regexp.last_match(2), + :sas_address => Regexp.last_match(6), :arrays => [] } @@ -570,11 +569,14 @@ Ohai.plugin(:Hardware) do disks.each do |disk| slot = controllers[disk[:controller]][:pci_slot] - bus = disk[:bus] - target = disk[:target] + sas_address = "0x#{disk[:sas_address]}" - if device = Dir.glob("/sys/bus/pci/devices/#{slot}/host*/port-*:*/end_device-*:*/target*:#{bus}:#{target}/*:#{bus}:#{target}:0/scsi_generic/sg*").first - disk[:device] = "/dev/#{File.basename(device)}" + Dir.glob("/sys/bus/pci/devices/#{slot}/host*/port-*:*/end_device-*:*/sas_device/end_device-*:*").each do |sas_device| + if read_sysctl_file("#{sas_device}/sas_address") == sas_address + if device = Dir.glob("#{sas_device}/device/target*:0:*/*:0:*:0/scsi_generic/sg*").first + disk[:device] = "/dev/#{File.basename(device)}" + end + end end end end