]> git.openstreetmap.org Git - chef.git/blob - cookbooks/hardware/attributes/default.rb
Replace intelmas with sst
[chef.git] / cookbooks / hardware / attributes / default.rb
1 default[:hardware][:modules] = %w[lp]
2 default[:hardware][:blacklisted_modules] = %w[]
3 default[:hardware][:grub][:cmdline] = %w[nomodeset]
4 default[:hardware][:sensors] = {}
5 default[:hardware][:hwmon] = {}
6 default[:hardware][:ipmi][:excluded_sensors] = []
7 default[:hardware][:ipmi][:custom_args] = []
8
9 if node[:dmi] && node[:dmi][:system]
10   case node[:dmi][:system][:manufacturer]
11   when "HP"
12     case node[:dmi][:system][:product_name]
13     when "ProLiant DL360 G6", "ProLiant DL360 G7", "ProLiant SE326M1R2"
14       default[:hardware][:sensors][:"power_meter-*"][:power][:power1] = { :ignore => true }
15     end
16
17     case node[:dmi][:system][:product_name]
18     when "ProLiant DL360 G6", "ProLiant DL360 G7", "ProLiant SE326M1R2", "ProLiant DL360e Gen8", "ProLiant DL360p Gen8"
19       default[:hardware][:ipmi][:custom_args] |= ["--workaround-flags=discretereading"]
20     end
21   end
22 end
23
24 if Chef::Util.compare_versions(node[:kernel][:release], [3, 3]).negative?
25   default[:hardware][:modules] |= ["microcode"]
26
27   if node[:cpu][:"0"][:vendor_id] == "GenuineIntel"
28     default[:hardware][:modules] |= ["coretemp"]
29   end
30 end
31
32 if node[:kernel][:modules].include?("ipmi_si")
33   default[:hardware][:modules] |= ["ipmi_devintf"]
34
35   if node[:kernel][:modules].include?("acpi_power_meter")
36     default[:hardware][:modules] |= ["acpi_ipmi"]
37   end
38 end
39
40 if File.exist?("/proc/xen")
41   default[:hardware][:watchdog] = "xen_wdt"
42 elsif node[:kernel][:modules].include?("i6300esb")
43   default[:hardware][:watchdog] = "none"
44 end
45
46 if File.exist?("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor") &&
47    File.read("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor").chomp == "ondemand"
48   default[:sysfs][:cpufreq_ondemand][:comment] = "Tune the ondemand CPU frequency governor"
49   default[:sysfs][:cpufreq_ondemand][:parameters][:"devices/system/cpu/cpufreq/ondemand/up_threshold"] = "25"
50   default[:sysfs][:cpufreq_ondemand][:parameters][:"devices/system/cpu/cpufreq/ondemand/sampling_down_factor"] = "100"
51 end
52
53 energy_perf_bias = Dir.glob("/sys/devices/system/cpu/cpu*/power/energy_perf_bias")
54
55 unless energy_perf_bias.empty?
56   default[:sysfs][:cpu_power_energy_perf_bias][:comment] = "Set CPU Energy-Performance Bias Preference to performance"
57
58   energy_perf_bias.sort.each do |path|
59     default[:sysfs][:cpu_power_energy_perf_bias][:parameters][path.sub(%r{^/sys/}, "")] = "0"
60   end
61 end