diff --git a/backport-API-libcrmcommon-deprecate-PCMK_VALUE_FENCE_LEGACY-d.patch b/backport-API-libcrmcommon-deprecate-PCMK_VALUE_FENCE_LEGACY-d.patch new file mode 100644 index 0000000000000000000000000000000000000000..3cfaa1835178470c43fa6040c9fa331689197a82 --- /dev/null +++ b/backport-API-libcrmcommon-deprecate-PCMK_VALUE_FENCE_LEGACY-d.patch @@ -0,0 +1,27 @@ +From 61507432017a09005173771a76cb45bbf4d212e5 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 27 Aug 2024 17:43:03 -0500 +Subject: [PATCH] API: libcrmcommon: deprecate PCMK_VALUE_FENCE_LEGACY defined + constant + +Ref T279 +--- + include/crm/common/options.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/crm/common/options.h b/include/crm/common/options.h +index 64cbf5ea28..0e8730f39d 100644 +--- a/include/crm/common/options.h ++++ b/include/crm/common/options.h +@@ -220,7 +220,7 @@ extern "C" { + #define PCMK_VALUE_WRITE "write" + #define PCMK_VALUE_YELLOW "yellow" + +-// @COMPAT This will become a deprecated alias for PCMK_VALUE_FENCE (see T279) ++// \deprecated Use PCMK_VALUE_FENCE instead + #define PCMK_VALUE_FENCE_LEGACY "suicide" + + +-- +2.33.1.windows.1 + diff --git a/backport-Log-fencer-update-terminology-in-trace-message.patch b/backport-Log-fencer-update-terminology-in-trace-message.patch new file mode 100644 index 0000000000000000000000000000000000000000..930168e7c0498eb0b19a950ee9807fd0ae83ed3c --- /dev/null +++ b/backport-Log-fencer-update-terminology-in-trace-message.patch @@ -0,0 +1,43 @@ +From 25034bbe3413e440afe59476c21e2fd1de001c1d Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 27 Aug 2024 16:43:39 -0500 +Subject: [PATCH] Log: fencer: update terminology in trace message + +... and comments + +Ref T279 +--- + daemons/fenced/fenced_remote.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c +index 653c2e697b..7d54e3b2be 100644 +--- a/daemons/fenced/fenced_remote.c ++++ b/daemons/fenced/fenced_remote.c +@@ -1034,7 +1034,7 @@ merge_duplicates(remote_fencing_op_t *op) + continue; + } + if (pcmk__str_eq(other->target, other->originator, pcmk__str_casei)) { +- crm_trace("%.8s not duplicate of %.8s: suicide for %s", ++ crm_trace("%.8s not duplicate of %.8s: self-fencing for %s", + op->id, other->id, other->target); + continue; + } +@@ -1983,10 +1983,10 @@ request_peer_fencing(remote_fencing_op_t *op, peer_device_info_t *peer) + come back in between + - Delicate might be the case where we have watchdog-fencing + enabled for a node but the watchdog-fencing-device isn't +- explicitly chosen for suicide. Local pe-execution in sbd +- may detect the node as unclean and lead to timely suicide. +- Otherwise the selection of PCMK_OPT_STONITH_WATCHDOG_TIMEOUT +- at least is questionable. ++ explicitly chosen for self-fencing. Local scheduler execution ++ in sbd might detect the node as unclean and lead to timely ++ self-fencing. Otherwise the selection of ++ PCMK_OPT_STONITH_WATCHDOG_TIMEOUT at least is questionable. + */ + + /* coming here we're not waiting for watchdog timeout - +-- +2.33.1.windows.1 + diff --git a/backport-Low-libcib-improve-error-handling-in-cib_file_new.patch b/backport-Low-libcib-improve-error-handling-in-cib_file_new.patch new file mode 100644 index 0000000000000000000000000000000000000000..9a661a26eb2d23f009f1ac449799435be8e2878a --- /dev/null +++ b/backport-Low-libcib-improve-error-handling-in-cib_file_new.patch @@ -0,0 +1,72 @@ +From 2e5470541473af37f22c489cb87fe473c7ef85f3 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Mon, 26 Aug 2024 18:03:40 -0500 +Subject: [PATCH] Low: libcib: improve error handling in cib_file_new() + +Move argument validation to top so we don't leak memory on failure, +and check strdup() for failure. +--- + lib/cib/cib_file.c | 26 +++++++++++++++++++------- + 1 file changed, 19 insertions(+), 7 deletions(-) + +diff --git a/lib/cib/cib_file.c b/lib/cib/cib_file.c +index 24bd029406..9bb076743e 100644 +--- a/lib/cib/cib_file.c ++++ b/lib/cib/cib_file.c +@@ -647,34 +647,46 @@ cib_file_client_id(const cib_t *cib, const char **async_id, + cib_t * + cib_file_new(const char *cib_location) + { ++ cib_t *cib = NULL; + cib_file_opaque_t *private = NULL; +- cib_t *cib = cib_new_variant(); ++ char *filename = NULL; ++ ++ if (cib_location == NULL) { ++ cib_location = getenv("CIB_file"); ++ if (cib_location == NULL) { ++ return NULL; // Shouldn't be possible if we were called internally ++ } ++ } + ++ cib = cib_new_variant(); + if (cib == NULL) { + return NULL; + } + +- private = calloc(1, sizeof(cib_file_opaque_t)); ++ filename = strdup(cib_location); ++ if (filename == NULL) { ++ free(cib); ++ return NULL; ++ } + ++ private = calloc(1, sizeof(cib_file_opaque_t)); + if (private == NULL) { + free(cib); ++ free(filename); + return NULL; + } ++ + private->id = crm_generate_uuid(); ++ private->filename = filename; + + cib->variant = cib_file; + cib->variant_opaque = private; + +- if (cib_location == NULL) { +- cib_location = getenv("CIB_file"); +- CRM_CHECK(cib_location != NULL, return NULL); // Shouldn't be possible +- } + private->flags = 0; + if (cib_file_is_live(cib_location)) { + cib_set_file_flags(private, cib_file_flag_live); + crm_trace("File %s detected as live CIB", cib_location); + } +- private->filename = strdup(cib_location); + + /* assign variant specific ops */ + cib->delegate_fn = cib_file_perform_op_delegate; +-- +2.33.1.windows.1 + diff --git a/backport-Refactor-fencer-rename-variables-for-terminology-cha.patch b/backport-Refactor-fencer-rename-variables-for-terminology-cha.patch new file mode 100644 index 0000000000000000000000000000000000000000..28b16f67dba4feb32ca033b72f37d1bccf537b85 --- /dev/null +++ b/backport-Refactor-fencer-rename-variables-for-terminology-cha.patch @@ -0,0 +1,121 @@ +From f0c513adf5b89b20b15ef2ea22f4f6c8d9b6e767 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 27 Aug 2024 16:41:33 -0500 +Subject: [PATCH] Refactor: fencer: rename variables for terminology change + +Ref T279 +--- + daemons/fenced/fenced_commands.c | 30 ++++++++++++++++-------------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +diff --git a/daemons/fenced/fenced_commands.c b/daemons/fenced/fenced_commands.c +index dc8ace77b7..63110fbc83 100644 +--- a/daemons/fenced/fenced_commands.c ++++ b/daemons/fenced/fenced_commands.c +@@ -52,7 +52,7 @@ struct device_search_s { + /* number of device replies received so far */ + int replies_received; + /* whether the target is eligible to perform requested action (or off) */ +- bool allow_suicide; ++ bool allow_self; + + /* private data to pass to search callback function */ + void *user_data; +@@ -2057,13 +2057,13 @@ search_devices_record_result(struct device_search_s *search, const char *device, + * \param[in] device Fence device to check + * \param[in] action Fence action to check + * \param[in] target Hostname of fence target +- * \param[in] allow_suicide Whether self-fencing is allowed for this operation ++ * \param[in] allow_self Whether self-fencing is allowed for this operation + * + * \return TRUE if local host is allowed to execute action, FALSE otherwise + */ + static gboolean + localhost_is_eligible(const stonith_device_t *device, const char *action, +- const char *target, gboolean allow_suicide) ++ const char *target, gboolean allow_self) + { + gboolean localhost_is_target = pcmk__str_eq(target, stonith_our_uname, + pcmk__str_casei); +@@ -2079,7 +2079,7 @@ localhost_is_eligible(const stonith_device_t *device, const char *action, + return FALSE; + } + +- } else if (localhost_is_target && !allow_suicide) { ++ } else if (localhost_is_target && !allow_self) { + crm_trace("'%s' operation does not support self-fencing", action); + return FALSE; + } +@@ -2158,7 +2158,7 @@ can_fence_host_with_device(stonith_device_t *dev, + goto search_report_results; + + } else if (!localhost_is_eligible_with_remap(dev, action, target, +- search->allow_suicide)) { ++ search->allow_self)) { + check_type = "This node is not allowed to execute action"; + goto search_report_results; + } +@@ -2250,8 +2250,10 @@ search_devices(gpointer key, gpointer value, gpointer user_data) + + #define DEFAULT_QUERY_TIMEOUT 20 + static void +-get_capable_devices(const char *host, const char *action, int timeout, bool suicide, void *user_data, +- void (*callback) (GList * devices, void *user_data), uint32_t support_action_only) ++get_capable_devices(const char *host, const char *action, int timeout, ++ bool allow_self, void *user_data, ++ void (*callback) (GList * devices, void *user_data), ++ uint32_t support_action_only) + { + struct device_search_s *search; + guint ndevices = g_hash_table_size(device_list); +@@ -2266,7 +2268,7 @@ get_capable_devices(const char *host, const char *action, int timeout, bool suic + search->host = pcmk__str_copy(host); + search->action = pcmk__str_copy(action); + search->per_device_timeout = timeout; +- search->allow_suicide = suicide; ++ search->allow_self = allow_self; + search->callback = callback; + search->user_data = user_data; + search->support_action_only = support_action_only; +@@ -2360,13 +2362,13 @@ add_action_specific_attributes(xmlNode *xml, const char *action, + * \param[in] action Fence action + * \param[in] device Fence device + * \param[in] target Fence target +- * \param[in] allow_suicide Whether self-fencing is allowed ++ * \param[in] allow_self Whether self-fencing is allowed + */ + static void + add_disallowed(xmlNode *xml, const char *action, const stonith_device_t *device, +- const char *target, gboolean allow_suicide) ++ const char *target, gboolean allow_self) + { +- if (!localhost_is_eligible(device, action, target, allow_suicide)) { ++ if (!localhost_is_eligible(device, action, target, allow_self)) { + crm_trace("Action '%s' using %s is disallowed for local host", + action, device->id); + pcmk__xe_set_bool_attr(xml, PCMK__XA_ST_ACTION_DISALLOWED, true); +@@ -2381,18 +2383,18 @@ add_disallowed(xmlNode *xml, const char *action, const stonith_device_t *device, + * \param[in] action Fence action + * \param[in] device Fence device + * \param[in] target Fence target +- * \param[in] allow_suicide Whether self-fencing is allowed ++ * \param[in] allow_self Whether self-fencing is allowed + */ + static void + add_action_reply(xmlNode *xml, const char *action, + const stonith_device_t *device, const char *target, +- gboolean allow_suicide) ++ gboolean allow_self) + { + xmlNode *child = pcmk__xe_create(xml, PCMK__XE_ST_DEVICE_ACTION); + + crm_xml_add(child, PCMK_XA_ID, action); + add_action_specific_attributes(child, action, device, target); +- add_disallowed(child, action, device, target, allow_suicide); ++ add_disallowed(child, action, device, target, allow_self); + } + + /*! +-- +2.33.1.windows.1 + diff --git a/pacemaker.spec b/pacemaker.spec index 1eef85033dc1808061acd8fb34534124cac071f7..25e12f51b5d407967bd62c9005badaae14ac44d9 100644 --- a/pacemaker.spec +++ b/pacemaker.spec @@ -17,7 +17,7 @@ ## can be incremented to build packages reliably considered "newer" ## than previously built packages with the same pcmkversion) %global pcmkversion 2.1.8 -%global specversion 8 +%global specversion 9 ## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build %global commit 3980678f0372f2c7c294c01f61d63f0b2cafaad1 @@ -168,6 +168,10 @@ Patch12: backport-Low-lrmd-Report-connection-failures-in-tls_handshake.pat Patch13: backport-Feature-lrmd-Perform-the-TLS-handshake-asynchronousl.patch Patch14: backport-API-libcrmcommon-add-pcmk_cib_node_shutdown.patch Patch15: backport-Fix-libcrmcommon-Detect-newly-created-alerts-section.patch +Patch16: backport-Refactor-fencer-rename-variables-for-terminology-cha.patch +Patch17: backport-Log-fencer-update-terminology-in-trace-message.patch +Patch18: backport-API-libcrmcommon-deprecate-PCMK_VALUE_FENCE_LEGACY-d.patch +Patch19: backport-Low-libcib-improve-error-handling-in-cib_file_new.patch Requires: resource-agents Requires: %{pkgname_pcmk_libs} = %{version}-%{release} @@ -775,6 +779,12 @@ exit 0 %license %{nagios_name}-%{nagios_hash}/COPYING %changelog +* Tue Dec 24 2024 liupei - 2.1.8-9 +- Refactor: fencer: rename variables for terminology change +- Log: fencer: update terminology in trace message +- API: libcrmcommon: deprecate PCMK_VALUE_FENCE_LEGACY defined constant +- Low: libcib: improve error handling in cib_file_new() + * Mon Dec 23 2024 liupei - 2.1.8-8 - API: libcrmcommon: add pcmk_cib_node_shutdown() - Fix: libcrmcommon: Detect newly created alerts section