Configure smartd for LSI FusionMPT disks
authorTom Hughes <tom@compton.nu>
Fri, 13 Mar 2015 10:57:59 +0000 (10:57 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 13 Mar 2015 10:57:59 +0000 (10:57 +0000)
cookbooks/hardware/recipes/default.rb

index eac54e7648043b006d0aa39b2009a43529cfd4d0..80473f779e1f36a8395ca1f0d4799f81b033a2f2 100644 (file)
@@ -285,6 +285,20 @@ if status_packages["megaclisas-status"]
   end
 end
 
+if status_packages["sas2ircu-status"]
+  Dir.glob("/sys/class/scsi_host/host*") do |host|
+    driver = File.new("#{host}/proc_name").read.chomp
+
+    next unless driver == "mpt2sas"
+
+    bus = host.sub("/sys/class/scsi_host/host", "")
+
+    Dir.glob("/sys/bus/scsi/devices/#{bus}:0:*/scsi_generic/*").each do |sg|
+      disks << { :device => File.basename(sg) }
+    end
+  end
+end
+
 if disks.count > 0
   package "smartmontools"