Faidon Liambotis has submitted this change and it was merged.
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(-)
Approvals:
Filippo Giunchedi: Looks good to me, but someone else must approve
Alexandros Kosiaris: Looks good to me, but someone else must approve
Faidon Liambotis: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/raid/lib/facter/raid.rb b/modules/raid/lib/facter/raid.rb
new file mode 100644
index 0000000..fdbddb6
--- /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/') || FileTest.exist?('/sys/module/hpsa/')
+ raids.push('hpsa')
+ end
+
+ if FileTest.exist?('/dev/megadev0') ||
+ Dir.glob('/sys/bus/pci/drivers/megaraid_sas/00*').length > 0
+ raids.push('megaraid')
+ end
+
+ if FileTest.exist?('/dev/mptctl') ||
+ FileTest.exist?('/dev/mpt0') ||
+ FileTest.exist?('/proc/mpt/summary') ||
+ 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
+
+ supported_devs = [ 'aac', 'twe' ]
+ IO.foreach('/proc/devices') do |x|
+ if /^\s*\d+\s+(?<dev>\w+)/ =~ x
+ raids.push(dev) if supported_devs.include?(dev)
+ end
+ end
+
+ if FileTest.exist?('/proc/mdstat')
+ 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: merged
Gerrit-Change-Id: Ie3b2ed86e088655b5361b2c45c80a2e0acdfc1cc
Gerrit-PatchSet: 9
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Jcrespo <[email protected]>
Gerrit-Reviewer: Volans <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits