]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
allow to configure watchdog module in /etc/default/pve-ha-manager
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 3 Dec 2015 10:07:39 +0000 (11:07 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 3 Dec 2015 10:13:14 +0000 (11:13 +0100)
All watchdog modules are blacklisted, so we cannot load them via /etc/modules.
Instead, watchdog-mux loads it at startup.

debian/pve-ha-manager.default [new file with mode: 0644]
debian/watchdog-mux.service
src/watchdog-mux.c

diff --git a/debian/pve-ha-manager.default b/debian/pve-ha-manager.default
new file mode 100644 (file)
index 0000000..3f33ff0
--- /dev/null
@@ -0,0 +1,2 @@
+# select watchdog module (default is softdog)
+#WATCHDOG_MODULE=ipmi_watchdog
\ No newline at end of file
index c701b3a9fdaf2344641e41d03d84a49a7d48b1a0..cd28df80d492ce65bfd30249f622331fd1878fdd 100644 (file)
@@ -2,6 +2,7 @@
 Description=Proxmox VE watchdog multiplexer
 
 [Service]
+EnvironmentFile=-/etc/default/pve-ha-manager
 ExecStart=/usr/sbin/watchdog-mux
 OOMScoreAdjust=-1000
 Restart=no
index de43aa36ee29b1670a4aede3fdf9190800b5efb2..2b440131d4fb18aada436cc080a6a7e784792977 100644 (file)
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -120,7 +121,17 @@ main(void)
      * options softdog soft_noboot=1
      */
     if (stat(WATCHDOG_DEV, &fs) == -1) {
-        system("modprobe -q softdog"); // load softdog by default
+        char *wd_module = getenv("WATCHDOG_MODULE");
+        if (wd_module) {
+            char *cmd = NULL;
+            if ((asprintf(&cmd, "modprobe -q %s", wd_module) == -1)) {
+                perror("assemble modprobe command failed");
+                exit(EXIT_FAILURE);
+            }
+            system(cmd);
+        } else {
+            system("modprobe -q softdog"); // load softdog by default
+        }
     }
 
     if ((watchdog_fd = open(WATCHDOG_DEV, O_WRONLY)) == -1) {