X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/85b1552114bd1cecf242caffcd4015500675bf9e..a758d8df5ed787e688b6e6185ba605e448e5943d:/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 f6b854c99..97a8823c2 100644 --- a/cookbooks/hardware/templates/default/ohai.rb.erb +++ b/cookbooks/hardware/templates/default/ohai.rb.erb @@ -253,19 +253,10 @@ Ohai.plugin(:Hardware) do end def find_md_arrays(devices) - controller = { - :id => devices[:controllers].count, - :type => "md", - :arrays => [], - :disks => [] - } - - devices[:controllers] << controller - array = nil File.new("/proc/mdstat", "r").each do |line| - if line =~ /^(md\d+) : active raid(\d+)((?: (?:sd[a-z]|nvme\d+n\d+)\d*\[\d+\](?:\([A-Z]\))*)+)$/ + if line =~ /^(md\d+) : active raid(\d+)((?: (?:sd[a-z]\d*|nvme\d+n\d+(?:p\d+)?)\[\d+\](?:\([A-Z]\))*)+)$/ array = { :id => devices[:arrays].count, :device => "/dev/#{Regexp.last_match(1)}", @@ -294,7 +285,6 @@ Ohai.plugin(:Hardware) do end devices[:arrays] << array - controller[:arrays] << array[:id] elsif array && line =~ /^\s+(\d+) blocks.*(?:\[([U_]+)\])?/ array[:size] = format_disk_size(Regexp.last_match(1).to_i) array[:status] = "degraded" if Regexp.last_match(2) =~ /_/