From 6027abf8c73b183a22603e3de22799a52b993f39 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 21 Jul 2014 19:57:41 +0100 Subject: [PATCH] Add basic watchdog support for VMs --- cookbooks/hardware/recipes/default.rb | 22 +++++++++++++++++++ .../hardware/templates/default/watchdog.erb | 7 ++++++ 2 files changed, 29 insertions(+) create mode 100644 cookbooks/hardware/templates/default/watchdog.erb diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 59a078894..7923d3868 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -247,3 +247,25 @@ end end end end + +if File.exists?("/proc/xen") + watchdog = "xen_wdt" +elsif node[:kernel][:modules].include?("i6300esb") + watchdog = "none" +end + +if watchdog + package "watchdog" + + template "/etc/default/watchdog" do + source "watchdog.erb" + owner "root" + group "root" + mode 0644 + variables :module => watchdog + end + + service "watchdog" do + action [ :enable, :start ] + end +end diff --git a/cookbooks/hardware/templates/default/watchdog.erb b/cookbooks/hardware/templates/default/watchdog.erb new file mode 100644 index 000000000..afeef4448 --- /dev/null +++ b/cookbooks/hardware/templates/default/watchdog.erb @@ -0,0 +1,7 @@ +# 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). -- 2.43.2