From 6263c81dfe8bf78c1f47ab8a1e33aa896202dba0 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 3 Dec 2015 11:07:39 +0100 Subject: [PATCH] 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. --- debian/pve-ha-manager.default | 2 ++ debian/watchdog-mux.service | 1 + src/watchdog-mux.c | 13 ++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 debian/pve-ha-manager.default diff --git a/debian/pve-ha-manager.default b/debian/pve-ha-manager.default new file mode 100644 index 0000000..3f33ff0 --- /dev/null +++ b/debian/pve-ha-manager.default @@ -0,0 +1,2 @@ +# select watchdog module (default is softdog) +#WATCHDOG_MODULE=ipmi_watchdog \ No newline at end of file diff --git a/debian/watchdog-mux.service b/debian/watchdog-mux.service index c701b3a..cd28df8 100644 --- a/debian/watchdog-mux.service +++ b/debian/watchdog-mux.service @@ -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 diff --git a/src/watchdog-mux.c b/src/watchdog-mux.c index de43aa3..2b44013 100644 --- a/src/watchdog-mux.c +++ b/src/watchdog-mux.c @@ -1,3 +1,4 @@ +#define _GNU_SOURCE #include #include #include @@ -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) {