Skip to content

Commit

Permalink
change the megaraid_physical_drives fact to probe with lsscsi
Browse files Browse the repository at this point in the history
The existing smartctl based probe fails on rhel6.x with these package versions:

smartmontools-5.42-2.el6.x86_64
kernel-2.6.32-279.9.1.el6.x86_64

It's unknown if the smartctl probe works with other el6.x tool + kernel
combinations.  It's hoped that the lsscsi based probe will be more robost
(unless the output format of lsscsi changes).
  • Loading branch information
Joshua Hoblitt committed May 13, 2013
1 parent 73827bb commit 5a1fd71
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/facter/megaraid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def megacli_usable?
Facter::Util::Resolution.which('MegaCli')
end

def lsscsi_usable?
Facter::Util::Resolution.which('lsscsi')
end

Facter.add(:megaraid_physical_drives) do
confine :kernel => [ :Linux ]
setcode do
Expand Down Expand Up @@ -49,11 +53,11 @@ def megacli_usable?
confine :kernel => [ :Linux ]
setcode do
device = nil
if smartctl = Facter::Util::Resolution.which('smartctl')
out = Facter::Util::Resolution.exec(smartctl + ' --scan-open 2>&1')
if megacli_usable?
out = Facter::Util::Resolution.exec('lsscsi | awk \'{ if($2 == "disk" && $3 == "LSI") { print $6 } }\'')
out.each_line do |line|
if line =~ /open failed: DELL or MegaRaid controller/
device = (line.split(/\s+/))[0]
if line =~ /\/dev\/\S+/
device = line
end
end
end
Expand Down

0 comments on commit 5a1fd71

Please sign in to comment.