From e216a13f71c86d3ef7721a499972beffe388ba5f Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Thu, 29 Jun 2017 17:52:31 +0200 Subject: [PATCH 1/4] Fix: sbd-inquisitor: Respect the obsolete option SBD_WATCHDOG for backward compatibility SBD_WATCHDOG option has been dropped from sbd.sysconfig example. Re-enabling the support only in the code for backward compatibility. --- src/sbd-inquisitor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c index 3c3a5a0..2ef7c4b 100644 --- a/src/sbd-inquisitor.c +++ b/src/sbd-inquisitor.c @@ -862,6 +862,13 @@ int main(int argc, char **argv, char **envp) watchdogdev = strdup(value); } + /* SBD_WATCHDOG has been dropped from sbd.sysconfig example. + * This is for backward compatibility. */ + value = getenv("SBD_WATCHDOG"); + if(value) { + watchdog_use = crm_is_true(value); + } + value = getenv("SBD_WATCHDOG_TIMEOUT"); if(value) { timeout_watchdog = crm_get_msec(value) / 1000; From c527ba99c20b02ecbd195f74da321333a2ae534e Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Tue, 4 Jul 2017 16:45:33 +0200 Subject: [PATCH 2/4] Fix: sbd-inquisitor: Enable pacemaker integration by default as advertised in sysconfig.sbd "Default: yes" for SBD_PACEMAKER has always been advertised in the example sbd.sysconfig. This commit is to ensure that's true again. It can be disabled by either explicitly setting SBD_PACEMAKER=no in sysconfig or supplying "-P" option twice like "-P -P". --- man/sbd.8.pod | 5 ++++- src/sbd-inquisitor.c | 32 ++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/man/sbd.8.pod b/man/sbd.8.pod index 5df0b4e..3948bb4 100644 --- a/man/sbd.8.pod +++ b/man/sbd.8.pod @@ -267,7 +267,10 @@ If set to zero, processes will be restarted indefinitely and immediately. =item B<-P> -Check Pacemaker quorum and node health. +Check Pacemaker quorum and node health. Specify this once to enable, twice to +disable. + +Defaults to I. =item B<-S> I diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c index 2ef7c4b..4c47494 100644 --- a/src/sbd-inquisitor.c +++ b/src/sbd-inquisitor.c @@ -23,8 +23,8 @@ static struct servants_list_item *servants_leader = NULL; int disk_priority = 1; -int check_pcmk = 0; -int check_cluster = 0; +int check_pcmk = 1; +int check_cluster = 1; int disk_count = 0; int servant_count = 0; int servant_restart_interval = 5; @@ -799,11 +799,19 @@ parse_device_line(const char *line) return found; } +int +arg_enabled(int arg_count) +{ + return arg_count % 2; +} + int main(int argc, char **argv, char **envp) { int exit_status = 0; int c; - int w = 0; + int W_count = 0; + int c_count = 0; + int P_count = 0; int qb_facility; const char *value = NULL; int start_delay = 0; @@ -928,7 +936,7 @@ int main(int argc, char **argv, char **envp) cl_log(LOG_INFO, "Setting watchdog timeout disabled; using defaults."); break; case 'W': - w++; + W_count++; break; case 'w': cl_log(LOG_NOTICE, "Using watchdog device '%s'", watchdogdev); @@ -945,10 +953,10 @@ int main(int argc, char **argv, char **envp) #endif break; case 'c': - check_cluster = 1; + c_count++; break; case 'P': - check_pcmk = 1; + P_count++; break; case 'z': disk_priority = 0; @@ -1011,8 +1019,8 @@ int main(int argc, char **argv, char **envp) } } - if (w > 0) { - watchdog_use = w % 2; + if (W_count > 0) { + watchdog_use = arg_enabled(W_count); } else if(watchdogdev == NULL || strcmp(watchdogdev, "/dev/null") == 0) { watchdog_use = 0; @@ -1024,6 +1032,14 @@ int main(int argc, char **argv, char **envp) cl_log(LOG_INFO, "Watchdog disabled."); } + if (c_count > 0) { + check_cluster = arg_enabled(c_count); + } + + if (P_count > 0) { + check_pcmk = arg_enabled(P_count); + } + if ((disk_count > 0) && (strlen(local_uname) > SECTOR_NAME_MAX)) { fprintf(stderr, "Node name mustn't be longer than %d chars.\n", SECTOR_NAME_MAX); From 68c73ec1678fdb8472edbb0b9a9667311bcf55e8 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Tue, 4 Jul 2017 20:02:48 +0200 Subject: [PATCH 3/4] Fix: sbd-inquisitor: Do not use watchdog if the conflicting options "-W" and "-w /dev/null" are both supplied --- src/sbd-inquisitor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c index 4c47494..7b73808 100644 --- a/src/sbd-inquisitor.c +++ b/src/sbd-inquisitor.c @@ -1019,11 +1019,11 @@ int main(int argc, char **argv, char **envp) } } - if (W_count > 0) { - watchdog_use = arg_enabled(W_count); - - } else if(watchdogdev == NULL || strcmp(watchdogdev, "/dev/null") == 0) { + if (watchdogdev == NULL || strcmp(watchdogdev, "/dev/null") == 0) { watchdog_use = 0; + + } else if (W_count > 0) { + watchdog_use = arg_enabled(W_count); } if (watchdog_use) { From 2e076d4d1bae798aa6a7f82939942f78a29ab553 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Wed, 19 Jul 2017 09:57:24 +0200 Subject: [PATCH 4/4] Doc: man: Call "-P" option "Pacemaker integration" in the description So that it's in conjunction with other descriptions about "Pacemaker integration" in the man page. --- man/sbd.8.pod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/sbd.8.pod b/man/sbd.8.pod index 3948bb4..c1bf67a 100644 --- a/man/sbd.8.pod +++ b/man/sbd.8.pod @@ -267,8 +267,8 @@ If set to zero, processes will be restarted indefinitely and immediately. =item B<-P> -Check Pacemaker quorum and node health. Specify this once to enable, twice to -disable. +Enable Pacemaker integration which checks Pacemaker quorum and node health. +Specify this once to enable, twice to disable. Defaults to I.