]> git.openstreetmap.org Git - chef.git/commitdiff
Handle hpsa based RAID on newer HP machines
authorTom Hughes <tom@compton.nu>
Wed, 6 Nov 2013 10:13:12 +0000 (10:13 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 6 Nov 2013 10:13:12 +0000 (10:13 +0000)
cookbooks/hardware/recipes/default.rb

index a602852539a66b8575ac4967bbba7da7fda1fa49..c568cafd42d6a43d7fc8d7361f2b33f5478c3a27 100644 (file)
@@ -141,11 +141,13 @@ template "/etc/initramfs-tools/conf.d/mdadm" do
   notifies :run, "execute[update-initramfs]"
 end
 
-["cciss", "mptsas", "mpt2sas", "megaraid_mm", "megaraid_sas", "aacraid"].each do |raidmod|
+["cciss", "hpsa", "mptsas", "mpt2sas", "megaraid_mm", "megaraid_sas", "aacraid"].each do |raidmod|
   case raidmod
   when "cciss"
     tools_package = "hpacucli"
     status_package = "cciss-vol-status"
+  when "hpsa"
+    tools_package = "hpacucli"
   when "mptsas"
     tools_package = "lsiutil"
     status_package = "mpt-status"
@@ -165,31 +167,36 @@ end
 
   if node[:kernel][:modules].include?(raidmod)
     package tools_package
-    package status_package
-
-    template "/etc/default/#{status_package}d" do
-      source "raid.default.erb"
-      owner "root"
-      group "root"
-      mode 0644
-    end
 
-    service "#{status_package}d" do
-      action [ :start, :enable ]
-      supports :status => false, :restart => true, :reload => false
-      subscribes :restart, "template[/etc/default/#{status_package}d]"
+    if status_package
+      package status_package
+
+      template "/etc/default/#{status_package}d" do
+        source "raid.default.erb"
+        owner "root"
+        group "root"
+        mode 0644
+      end
+
+      service "#{status_package}d" do
+        action [ :start, :enable ]
+        supports :status => false, :restart => true, :reload => false
+        subscribes :restart, "template[/etc/default/#{status_package}d]"
+      end
     end
   else
-    package status_package do
-      action :purge
+    if status_package
+      package status_package do
+        action :purge
+      end
+
+      file "/etc/default/#{status_package}d" do
+        action :delete
+      end
     end
 
     package tools_package do
       action :purge
     end
-
-    file "/etc/default/#{status_package}d" do
-      action :delete
-    end
   end
 end