Faidon Liambotis has uploaded a new change for review. https://gerrit.wikimedia.org/r/290988
Change subject: raid: add a new "raid" fact ...................................................................... raid: add a new "raid" fact This holds a array of all the possible RAID configurations that can be found in one server. Hence, it will support configurations such as software RAID on top or on the side of hardware RAID, or multiple RAID controllers in one server. Unused for now -- it's still useful to populate the database with it, so that errors can be found before we can start using it. Bug: T84050 Change-Id: Ie3b2ed86e088655b5361b2c45c80a2e0acdfc1cc --- A modules/raid/lib/facter/raid.rb 1 file changed, 60 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/88/290988/1 diff --git a/modules/raid/lib/facter/raid.rb b/modules/raid/lib/facter/raid.rb new file mode 100644 index 0000000..e837fd7 --- /dev/null +++ b/modules/raid/lib/facter/raid.rb @@ -0,0 +1,60 @@ +Facter.add('raid') do + confine :kernel => :Linux + setcode do + raids = [] + + if FileTest.exist?('/dev/cciss/') or FileTest.exist?('/sys/module/hpsa/') + raids.push('hpsa') + end + + if FileTest.exist?('/dev/megadev0') or + Dir.glob('/sys/bus/pci/drivers/megaraid_sas/00*').length > 0 + raids.push('megaraid') + end + + if FileTest.exist?('/dev/mptctl') or + FileTest.exist?('/dev/mpt0') or + FileTest.exist?('/proc/mpt/summary') or + FileTest.exist?('/proc/scsi/mptsas/0') + raids.push('mpt') + end + + if FileTest.exist?('/dev/aac0') + raids.push('aacraid') + end + + if FileTest.exist?('/proc/scsi/scsi') + IO.foreach('/proc/scsi/scsi') do |x| + if x =~ /Vendor: 3ware/ + raids.push('3ware') + break + end + end + end + + IO.foreach('/proc/devices') do |x| + valid_devs = [ 'aac', 'twe', 'megadev' ] + if x =~ /^\s*\d+\s+(\w+)/ + raids.push($1) if valid_devs.include?($1) + end + end + + if FileTest.exist?('/proc/mdstat') and FileTest.exist?('/sbin/mdadm') + IO.foreach('/proc/mdstat') do |x| + if x =~ /md[0-9]+ : active/ + raids.push('md') + break + end + end + end + + raids.sort!.uniq! + + if Facter.version < '2.0.0' + raids.join(',') + else + raids + end + + end +end -- To view, visit https://gerrit.wikimedia.org/r/290988 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie3b2ed86e088655b5361b2c45c80a2e0acdfc1cc Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Faidon Liambotis <fai...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits