From 42dbea67cfbe7b2b9dd6eac5a62bac8c132a3bac Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 30 Nov 2015 11:57:36 +0000 Subject: [PATCH] Locate block devices for megaraid arrays --- cookbooks/hardware/templates/default/ohai.rb.erb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cookbooks/hardware/templates/default/ohai.rb.erb b/cookbooks/hardware/templates/default/ohai.rb.erb index e78e0c6bc..b371d3816 100644 --- a/cookbooks/hardware/templates/default/ohai.rb.erb +++ b/cookbooks/hardware/templates/default/ohai.rb.erb @@ -305,10 +305,15 @@ Ohai.plugin(:Hardware) do if line =~ /^Adapter #(\d+)$/ controller = controllers[Regexp.last_match(1).to_i] elsif controller && line =~ /^Virtual Drive: (\d+) \(Target Id: (\d+)\)$/ + pci_slot = controller[:pci_slot] + target = Regexp.last_match(2) + device = Dir.glob("/sys/bus/pci/devices/#{pci_slot}/host*/target*:2:#{target}/*:2:#{target}:0/block/*").first + array = { :id => devices[:arrays].count, :controller => controller[:id], :number => Regexp.last_match(1), + :device => "/dev/#{File.basename(device)}", :disks => [] } -- 2.39.5