]> git.openstreetmap.org Git - chef.git/commitdiff
Enable hardware watchdog on HP machines
authorTom Hughes <tom@compton.nu>
Mon, 4 Mar 2024 19:18:27 +0000 (19:18 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 4 Mar 2024 20:10:20 +0000 (20:10 +0000)
cookbooks/hardware/attributes/default.rb
cookbooks/hardware/recipes/default.rb
cookbooks/hardware/templates/default/watchdog.conf.erb [new file with mode: 0644]
cookbooks/hardware/templates/default/watchdog.erb [deleted file]

index 78ec107c7a08ea5c290d655cf504802838de2f19..218e6228e5ab476e4edc65761ceb7f31069ff399 100644 (file)
@@ -37,12 +37,6 @@ if node[:kernel][:modules].include?("ipmi_si")
   end
 end
 
-if File.exist?("/proc/xen")
-  default[:hardware][:watchdog] = "xen_wdt"
-elsif node[:kernel][:modules].include?("i6300esb")
-  default[:hardware][:watchdog] = "none"
-end
-
 if File.exist?("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor") &&
    File.read("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor").chomp == "ondemand"
   default[:sysfs][:cpufreq_ondemand][:comment] = "Tune the ondemand CPU frequency governor"
index d7c508d9aadabf7dd81929ec698643f1088cd6e8..93891599a5393434071bfc9005d59be875d39dba 100644 (file)
@@ -120,6 +120,8 @@ when "HP", "HPE"
            else
              "1"
            end
+
+  watchdog_module = "hpwdt"
 when "TYAN"
   units << "0"
 when "TYAN Computer Corporation"
@@ -609,19 +611,30 @@ node[:hardware][:blacklisted_modules].each do |module_name|
   end
 end
 
-if node[:hardware][:watchdog]
-  package "watchdog"
+if watchdog_module
+  kernel_module watchdog_module do
+    action :install
+  end
+
+  execute "systemctl-reload" do
+    action :nothing
+    command "systemctl daemon-reload"
+    user "root"
+    group "root"
+  end
 
-  template "/etc/default/watchdog" do
-    source "watchdog.erb"
+  directory "/etc/systemd/system.conf.d" do
     owner "root"
     group "root"
-    mode "644"
-    variables :module => node[:hardware][:watchdog]
+    mode "755"
   end
 
-  service "watchdog" do
-    action [:enable, :start]
+  template "/etc/systemd/system.conf.d/watchdog.conf" do
+    source "watchdog.conf.erb"
+    owner "root"
+    group "root"
+    mode "644"
+    notifies :run, "execute[systemctl-reload]"
   end
 end
 
diff --git a/cookbooks/hardware/templates/default/watchdog.conf.erb b/cookbooks/hardware/templates/default/watchdog.conf.erb
new file mode 100644 (file)
index 0000000..187622f
--- /dev/null
@@ -0,0 +1,4 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+[Manager]
+RuntimeWatchdogSec=60s
diff --git a/cookbooks/hardware/templates/default/watchdog.erb b/cookbooks/hardware/templates/default/watchdog.erb
deleted file mode 100644 (file)
index afeef44..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# DO NOT EDIT - This file is being maintained by Chef
-
-# Start watchdog at boot time? 0 or 1
-run_watchdog=1
-# Load module before starting watchdog
-watchdog_module="<%= @module %>"
-# Specify additional watchdog options here (see manpage).