From c25f8df597bbd0aa7340e5c8eeae56dd79f919ef Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Wed, 23 Nov 2022 11:18:07 +0100 Subject: [PATCH 1/4] Log: sbd-inquisitor: ensure a log info only tells the fact about how SBD_PACEMAKER is set It doesn't necessarily tell whether pacemaker integration is enabled, since it can be overridden by -P or -PP option. --- src/sbd-inquisitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c index 373621f..3e28bb8 100644 --- a/src/sbd-inquisitor.c +++ b/src/sbd-inquisitor.c @@ -950,7 +950,7 @@ int main(int argc, char **argv, char **envp) check_pcmk = crm_is_true(value); check_cluster = crm_is_true(value); } - cl_log(LOG_INFO, "Enable pacemaker checks: %d (%s)", (int)check_pcmk, value?value:"default"); + cl_log(LOG_INFO, "SBD_PACEMAKER set to: %d (%s)", (int)check_pcmk, value?value:"default"); value = get_env_option("SBD_STARTMODE"); if(value == NULL) { From ac1cfbbcf99d446c24e8d0eb1ed37092453b8a83 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Wed, 23 Nov 2022 12:27:36 +0100 Subject: [PATCH 2/4] Log: sbd-inquisitor: log a warning if SBD_PACEMAKER is overridden by -P or -PP option --- src/sbd-inquisitor.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c index 3e28bb8..aff1273 100644 --- a/src/sbd-inquisitor.c +++ b/src/sbd-inquisitor.c @@ -25,6 +25,7 @@ static struct servants_list_item *servants_leader = NULL; int disk_priority = 1; int check_pcmk = 1; int check_cluster = 1; +int has_check_pcmk_env = false; int disk_count = 0; int servant_count = 0; int servant_restart_interval = 5; @@ -949,6 +950,8 @@ int main(int argc, char **argv, char **envp) if(value) { check_pcmk = crm_is_true(value); check_cluster = crm_is_true(value); + + has_check_pcmk_env = true; } cl_log(LOG_INFO, "SBD_PACEMAKER set to: %d (%s)", (int)check_pcmk, value?value:"default"); @@ -1202,7 +1205,17 @@ int main(int argc, char **argv, char **envp) } if (P_count > 0) { - check_pcmk = arg_enabled(P_count); + int check_pcmk_arg = arg_enabled(P_count); + + if (has_check_pcmk_env && check_pcmk_arg != check_pcmk) { + cl_log(LOG_WARNING, "Pacemaker integration is %s: " + "SBD_PACEMAKER=%s is overridden by %s option. " + "It's recommended to only use SBD_PACEMAKER.", + check_pcmk_arg? "enabled" : "disabled", + check_pcmk? "yes" : "no", + check_pcmk_arg? "-P" : "-PP"); + } + check_pcmk = check_pcmk_arg; } if ((disk_count > 0) && (strlen(local_uname) > SECTOR_NAME_MAX)) { From 82282ac1c679d35a2bb0c4778b6e97499ce80785 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Wed, 23 Nov 2022 16:48:41 +0100 Subject: [PATCH 3/4] Log: sbd-inquisitor: do not warn about startup syncing if pacemaker integration is even intentionally disabled It doesn't make sense to recommend startup syncing if one doesn't even want pacemaker integration. --- src/sbd-inquisitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c index aff1273..9f2de20 100644 --- a/src/sbd-inquisitor.c +++ b/src/sbd-inquisitor.c @@ -1289,7 +1289,7 @@ int main(int argc, char **argv, char **envp) goto out; } #else - if (!sync_resource_startup) { + if (check_pcmk && !sync_resource_startup) { cl_log(LOG_WARNING, "SBD built against pacemaker supporting " "pacemakerd-API. Should think about enabling " "SBD_SYNC_RESOURCE_STARTUP."); From bacb6e78a9bd06448cc82959b195db8e3ff98d7d Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Wed, 23 Nov 2022 17:43:40 +0100 Subject: [PATCH 4/4] Fix: sbd-inquisitor: fail startup if pacemaker integration is disabled while SBD_SYNC_RESOURCE_STARTUP is conflicting And tell user to fix the configuration by either enabling SBD_PACEMAKER or explicitly disabling SBD_SYNC_RESOURCE_STARTUP. Otherwise startup of pacemaker would be hanging forever, since pacemaker only knows about SBD_SYNC_RESOURCE_STARTUP. --- src/sbd-inquisitor.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c index 9f2de20..d917cd1 100644 --- a/src/sbd-inquisitor.c +++ b/src/sbd-inquisitor.c @@ -1293,6 +1293,12 @@ int main(int argc, char **argv, char **envp) cl_log(LOG_WARNING, "SBD built against pacemaker supporting " "pacemakerd-API. Should think about enabling " "SBD_SYNC_RESOURCE_STARTUP."); + + } else if (!check_pcmk && sync_resource_startup) { + fprintf(stderr, "Set SBD_PACEMAKER=yes to allow resource startup syncing. " + "Otherwise explicitly set SBD_SYNC_RESOURCE_STARTUP=no if to intentionally disable.\n"); + exit_status = -1; + goto out; } #endif }