2bc3f0ed19f61e57ae22d9c4edf5fb0ff47f4a9d
[mirror/dsa-puppet.git] / facts / raidarray.rb
1 Facter.add("smartarraycontroller") do
2         confine :kernel => :linux
3         setcode do
4                 FileTest.exist?("/dev/cciss/")
5         end
6 end
7
8 Facter.add("mptcontroller") do
9         confine :kernel => :linux
10         setcode do
11                 FileTest.exist?("/proc/mpt/summary")
12         end
13 end
14
15 Facter.add("ThreeWarecontroller") do
16         confine :kernel => :linux
17         setcode do
18                 is3w = "false"
19                 if FileTest.exist?("/proc/scsi/scsi")
20                         IO.foreach("/proc/scsi/scsi") { |x|
21                                 is3w = "true" if x =~ /Vendor: 3ware/
22                         }
23                 end
24                 is3w == "true"
25         end
26 end
27
28 Facter.add("swraid") do
29         confine :kernel => :linux
30         setcode do
31                 swraid = "false"
32                 if FileTest.exist?("/proc/mdstat") && FileTest.exist?("/sbin/mdadm")
33                         IO.foreach("/proc/mdstat") { |x|
34                                 swraid = "true" if x =~ /md[0-9]+ : active/
35                         }
36                 end
37                 swraid == "true"
38         end
39 end
40