X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/cb17de3ad93b395219a25860f926fc0d8e1c3105..4d81711580ed328384d60781d95df39df528a6b3:/cookbooks/hardware/templates/default/ohai.rb.erb?ds=sidebyside diff --git a/cookbooks/hardware/templates/default/ohai.rb.erb b/cookbooks/hardware/templates/default/ohai.rb.erb index 1ca3de03a..e83343a8e 100644 --- a/cookbooks/hardware/templates/default/ohai.rb.erb +++ b/cookbooks/hardware/templates/default/ohai.rb.erb @@ -190,7 +190,7 @@ Ohai.plugin(:Hardware) do Dir.glob("/sys/class/scsi_host/host*") do |host| driver = read_sysctl_file("#{host}/proc_name") - if driver == "ahci" || driver == "mptsas" + if %w(ahci mptsas sata_mv sata_nv).include?(driver) bus = host.sub("/sys/class/scsi_host/host", "") Dir.glob("/sys/bus/scsi/devices/#{bus}:0:*").each do |device| @@ -214,7 +214,7 @@ Ohai.plugin(:Hardware) do end def find_nvme_disks(devices) - Dir.glob("/sys/class/misc/nvme*") do |device| + Dir.glob("/sys/class/nvme/nvme*") do |device| controller = { :id => devices[:controllers].count, :pci_slot => File.basename(Pathname.new("#{device}/device").realpath), @@ -232,7 +232,7 @@ Ohai.plugin(:Hardware) do end end - Dir.glob("#{device}/device/block/*").each do |block| + Dir.glob("#{device}/nvme*").each do |block| size = read_sysctl_file("#{block}/size").to_f / 2 disk = { @@ -358,6 +358,8 @@ Ohai.plugin(:Hardware) do controller[:device] = File.basename(device).sub(/^cciss(\d+)$/, "/dev/cciss/c\\1d0") elsif device = Dir.glob("/sys/bus/pci/devices/#{controller[:pci_slot]}/host*/target*:3:0/*:3:0:0/scsi_generic/sg*").first controller[:device] = "/dev/#{File.basename(device)}" + elsif device = Dir.glob("/sys/bus/pci/devices/#{controller[:pci_slot]}/host*/target*:1:0/*:1:0:0/scsi_generic/sg*").first + controller[:device] = "/dev/#{File.basename(device)}" end end end