From 12959860ac56b527e986d50f794b1d311e66b025 Mon Sep 17 00:00:00 2001 From: Yan Gao Date: Mon, 9 Mar 2026 17:50:26 +0100 Subject: [PATCH] Fix: fencer: Make the deprecated "stonith-watchdog-timeout" option work again This fixes a regression introduced by d7cc9b45a7, which has not made it into made it into any release. Even though "stonith-watchdog-timeout" option has become a deprecated alias for "fencing-watchdog-timeout", we need to make sure it still works as a fallback until it's dropped in a future release. Controller's config_query_callback() invokes pcmk__validate_cluster_options(config_hash) beforehand, which handles any settings with deprecated option names. I'll leave the g_hash_table_lookup() calls there. --- daemons/fenced/fenced_cib.c | 20 ++++++++++++++++++++ lib/lrmd/lrmd_client.c | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/daemons/fenced/fenced_cib.c b/daemons/fenced/fenced_cib.c index 9ecf635f371..20144b54ccc 100644 --- a/daemons/fenced/fenced_cib.c +++ b/daemons/fenced/fenced_cib.c @@ -146,6 +146,15 @@ fencing_topology_init(void) "[@" PCMK_XA_NAME "='" \ PCMK_OPT_FENCING_WATCHDOG_TIMEOUT "']" +/* @COMPAT The "stonith-watchdog-timeout" option has been a deprecated alias + * for "fencing-watchdog-timeout" since 3.0.2. Make sure it still works as a + * fallback until it's dropped in a future release. + */ +#define XPATH_STONITH_WATCHDOG_TIMEOUT "//" PCMK_XE_NVPAIR \ + "[@" PCMK_XA_NAME \ + "='stonith-watchdog-timeout']" + + static void update_fencing_watchdog_timeout_ms(xmlNode *cib) { @@ -157,6 +166,17 @@ update_fencing_watchdog_timeout_ms(xmlNode *cib) stonith_watchdog_xml = pcmk__xpath_find_one(cib->doc, XPATH_WATCHDOG_TIMEOUT, PCMK__LOG_NEVER); + + /* @COMPAT The "stonith-watchdog-timeout" option has been a deprecated alias + * for "fencing-watchdog-timeout" since 3.0.2. Make sure it still works as a + * fallback until it's dropped in a future release. + */ + if (stonith_watchdog_xml == NULL) { + stonith_watchdog_xml = pcmk__xpath_find_one(cib->doc, + XPATH_STONITH_WATCHDOG_TIMEOUT, + PCMK__LOG_NEVER); + } + if (stonith_watchdog_xml == NULL) { return; } diff --git a/lib/lrmd/lrmd_client.c b/lib/lrmd/lrmd_client.c index 4e7e74463e2..4e41f84be2d 100644 --- a/lib/lrmd/lrmd_client.c +++ b/lib/lrmd/lrmd_client.c @@ -979,7 +979,7 @@ lrmd__validate_remote_settings(lrmd_t *lrmd, GHashTable *hash) pcmk__xe_set(data, PCMK__XA_LRMD_ORIGIN, __func__); - value = g_hash_table_lookup(hash, PCMK_OPT_FENCING_WATCHDOG_TIMEOUT); + value = pcmk__cluster_option(hash, PCMK_OPT_FENCING_WATCHDOG_TIMEOUT); if ((value) && (stonith__watchdog_fencing_enabled_for_node(native->remote_nodename))) { pcmk__xe_set(data, PCMK__XA_LRMD_WATCHDOG, value);