X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/bf5bc83bde36fecc4625395300af0035d725c1df..4b684eea1ab4af459576aac53d761f0af6fb46ef:/cookbooks/hardware/recipes/default.rb diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 4b7e4478d..a561681ac 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -40,7 +40,6 @@ case manufacturer when "HP" package "hponcfg" package "hp-health" - package "hpacucli" unit = "1" speed = "115200" when "TYAN" @@ -142,7 +141,81 @@ template "/etc/initramfs-tools/conf.d/mdadm" do notifies :run, "execute[update-initramfs]" end -if node[:kernel][:modules].include?("mpt2sas") - package "sas2ircu" - package "sas2ircu-status" +tools_packages = [] +status_packages = {} + +node[:kernel][:modules].each_key do |modname| + case modname + when "cciss" + tools_packages << "hpacucli" + status_packages["cciss-vol-status"] ||= [] + when "hpsa" + tools_packages << "hpacucli" + status_packages["cciss-vol-status"] ||= [] + when "mptsas" + tools_packages << "lsiutil" + #status_packages["mpt-status"] ||= [] + when "mpt2sas" + tools_packages << "sas2ircu" + status_packages["sas2ircu-status"] ||= [] + when "megaraid_mm" + tools_packages << "megactl" + status_packages["megaraid-status"] ||= [] + when "megaraid_sas" + tools_packages << "megacli" + status_packages["megaclisas-status"] ||= [] + when "aacraid" + tools_packages << "arcconf" + status_packages["aacraid-status"] ||= [] + end +end + +node[:block_device].each do |name,attributes| + if attributes[:vendor] == "HP" and attributes[:model] == "LOGICAL VOLUME" + if name =~ /^cciss!(c[0-9]+)d[0-9]+$/ + status_packages["cciss-vol-status"] |= [ "cciss/#{$1}d0" ] + else + Dir.glob("/sys/block/#{name}/device/scsi_generic/*").each do |sg| + status_packages["cciss-vol-status"] |= [ File.basename(sg) ] + end + end + end +end + +["hpacucli", "lsiutil", "sas2ircu", "megactl", "megacli", "arcconf"].each do |tools_package| + if tools_packages.include?(tools_package) + package tools_package + else + package tools_package do + action :purge + end + end +end + +["cciss-vol-status", "mpt-status", "sas2ircu-status", "megaraid-status", "megaclisas-status", "aacraid-status"].each do |status_package| + if status_packages.include?(status_package) + package status_package + + template "/etc/default/#{status_package}d" do + source "raid.default.erb" + owner "root" + group "root" + mode 0644 + variables :devices => status_packages[status_package] + 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 + else + package status_package do + action :purge + end + + file "/etc/default/#{status_package}d" do + action :delete + end + end end