allow to configure watchdog module in /etc/default/pve-ha-manager

All watchdog modules are blacklisted, so we cannot load them via /etc/modules.
Instead, watchdog-mux loads it at startup.
This commit is contained in:
Dietmar Maurer 2015-12-03 11:07:39 +01:00
parent 7ce093b0af
commit 6263c81dfe
3 changed files with 15 additions and 1 deletions

2
debian/pve-ha-manager.default vendored Normal file
View File

@ -0,0 +1,2 @@
# select watchdog module (default is softdog)
#WATCHDOG_MODULE=ipmi_watchdog

View 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

View 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) {