diff --git a/0001-Add-the-parameter-of-dampening-and-fix-attrd_updater-HealthIOWait.patch b/0001-Add-the-parameter-of-dampening-and-fix-attrd_updater-HealthIOWait.patch new file mode 100644 index 0000000000000000000000000000000000000000..b4ce0050cdcad6375c0f7dd97ac457177d06c85f --- /dev/null +++ b/0001-Add-the-parameter-of-dampening-and-fix-attrd_updater-HealthIOWait.patch @@ -0,0 +1,63 @@ +From 30271f16c9878a03b803d2f1e6b5b5ec214a6365 Mon Sep 17 00:00:00 2001 +From: liupei +Date: Wed, 23 Aug 2023 19:02:10 +0800 +Subject: [PATCH] Add the parameter of dampening and fix attrd_updater command + +--- + agents/ocf/HealthIOWait.in | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/agents/ocf/HealthIOWait.in b/agents/ocf/HealthIOWait.in +index ba7a17a..de2844b 100644 +--- a/agents/ocf/HealthIOWait.in ++++ b/agents/ocf/HealthIOWait.in +@@ -60,6 +60,15 @@ the #health-iowait will go red if the %iowait of the CPU get higher than 15%. + + + ++ ++ ++The time to wait (dampening) in seconds for further changes before writing ++ ++The time to wait (dampening) in seconds for further changes ++before writing ++ ++ ++ + + + +@@ -109,16 +118,16 @@ agent_monitor() { + # echo $OCF_RESKEY_yellow_limit + if [ $WAIT -gt ${OCF_RESKEY_red_limit} ] ; then + # echo "System state RED!" +- attrd_updater -n "#health-iowait" -U "red" -d "5s" ++ attrd_updater -n "#health-iowait" -B "red" -d ${OCF_RESKEY_dampening} + return $OCF_SUCCESS + fi + + if [ $WAIT -gt ${OCF_RESKEY_yellow_limit} ] ; then + # echo "System state yellow." +- attrd_updater -n "#health-iowait" -U "yellow" -d "5s" ++ attrd_updater -n "#health-iowait" -B "yellow" -d ${OCF_RESKEY_dampening} + else + # echo "System state green." +- attrd_updater -n "#health-iowait" -U "green" -d "5s" ++ attrd_updater -n "#health-iowait" -B "green" -d ${OCF_RESKEY_dampening} + fi + return $OCF_SUCCESS + fi +@@ -175,6 +184,10 @@ if [ -z "${OCF_RESKEY_yellow_limit}" ] ; then + OCF_RESKEY_yellow_limit=10 + fi + ++if [ -z "${OCF_RESKEY_dampening}" ]; then ++ OCF_RESKEY_dampening="5s" ++fi ++ + case $__OCF_ACTION in + meta-data) meta_data + exit $OCF_SUCCESS +-- +2.33.1.windows.1 + diff --git a/0001-Add-the-parameter-of-dampening-and-fix-attrd_updater.patch b/0001-Add-the-parameter-of-dampening-and-fix-attrd_updater.patch new file mode 100644 index 0000000000000000000000000000000000000000..bd864d7d84c255ab41e9d43b3c983c153c064e49 --- /dev/null +++ b/0001-Add-the-parameter-of-dampening-and-fix-attrd_updater.patch @@ -0,0 +1,62 @@ +From 92d5801b36408c3e6af561ecb546df0641212b4a Mon Sep 17 00:00:00 2001 +From: liupei +Date: Wed, 23 Aug 2023 11:28:38 +0800 +Subject: [PATCH] Add the parameter of dampening and fix attrd_updater command + +--- + agents/ocf/HealthCPU.in | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +diff --git a/agents/ocf/HealthCPU.in b/agents/ocf/HealthCPU.in +index 4a8e7c3..a852a7a 100644 +--- a/agents/ocf/HealthCPU.in ++++ b/agents/ocf/HealthCPU.in +@@ -67,6 +67,15 @@ the #health-cpu will go red if the %idle of the CPU falls below 10%. + + + ++ ++ ++The time to wait (dampening) in seconds for further changes before writing ++ ++The time to wait (dampening) in seconds for further changes ++before writing ++ ++ ++ + + + +@@ -117,16 +126,16 @@ healthcpu_monitor() { + + if [ $IDLE -lt ${OCF_RESKEY_red_limit} ] ; then + # echo "System state RED!" +- attrd_updater -n "#health-cpu" -U "red" -d "30s" ++ attrd_updater -n "#health-cpu" -B "red" -d ${OCF_RESKEY_dampening} + return $OCF_SUCCESS + fi + + if [ $IDLE -lt ${OCF_RESKEY_yellow_limit} ] ; then + # echo "System state yellow." +- attrd_updater -n "#health-cpu" -U "yellow" -d "30s" ++ attrd_updater -n "#health-cpu" -B "yellow" -d ${OCF_RESKEY_dampening} + else + # echo "System state green." +- attrd_updater -n "#health-cpu" -U "green" -d "30s" ++ attrd_updater -n "#health-cpu" -B "green" -d ${OCF_RESKEY_dampening} + fi + + return $OCF_SUCCESS +@@ -188,6 +197,9 @@ fi + if [ -z "${OCF_RESKEY_yellow_limit}" ] ; then + OCF_RESKEY_yellow_limit=50 + fi ++if [ -z "${OCF_RESKEY_dampening}" ]; then ++ OCF_RESKEY_dampening="30s" ++fi + + case "$__OCF_ACTION" in + meta-data) meta_data +-- +2.33.1.windows.1 + diff --git a/0001-Fix-glib-assertions.patch b/0001-Fix-glib-assertions.patch new file mode 100644 index 0000000000000000000000000000000000000000..5cc9aa6b2358e048d84ff848e79d9ff7189057a8 --- /dev/null +++ b/0001-Fix-glib-assertions.patch @@ -0,0 +1,125 @@ +From e3f6351646d40a533be1cdce83d23134b8d16f23 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 15 Aug 2023 19:13:14 +0800 +Subject: [PATCH] Fix glib assertions due to asynchronous metadata action + completing after shutdown begins + +--- + daemons/controld/controld_cib.c | 11 +++++++++-- + daemons/controld/controld_execd.c | 4 +++- + daemons/controld/controld_execd_state.c | 15 +++++++-------- + daemons/controld/controld_lrm.h | 5 ----- + 4 files changed, 19 insertions(+), 16 deletions(-) + +diff --git a/daemons/controld/controld_cib.c b/daemons/controld/controld_cib.c +index 94b99dd..43cf857 100644 +--- a/daemons/controld/controld_cib.c ++++ b/daemons/controld/controld_cib.c +@@ -841,10 +841,17 @@ cib_rsc_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *use + case pcmk_ok: + case -pcmk_err_diff_failed: + case -pcmk_err_diff_resync: +- crm_trace("Resource update %d complete: rc=%d", call_id, rc); ++ crm_trace("Resource history update completed (call=%d rc=%d)", ++ call_id, rc); + break; + default: +- crm_warn("Resource update %d failed: (rc=%d) %s", call_id, rc, pcmk_strerror(rc)); ++ if (call_id > 0) { ++ crm_warn("Resource history update %d failed: %s " ++ CRM_XS " rc=%d", call_id, pcmk_strerror(rc), rc); ++ } else { ++ crm_warn("Resource history update failed: %s " CRM_XS " rc=%d", ++ pcmk_strerror(rc), rc); ++ } + } + + if (call_id == pending_rsc_update) { +diff --git a/daemons/controld/controld_execd.c b/daemons/controld/controld_execd.c +index 0de399c..f37446b 100644 +--- a/daemons/controld/controld_execd.c ++++ b/daemons/controld/controld_execd.c +@@ -1394,7 +1394,9 @@ metadata_complete(int pid, const pcmk__action_result_t *result, void *user_data) + md = controld_cache_metadata(lrm_state->metadata_cache, data->rsc, + result->action_stdout); + } +- do_lrm_rsc_op(lrm_state, data->rsc, data->input_xml, md); ++ if (!pcmk_is_set(controld_globals.fsa_input_register, R_HA_DISCONNECTED)) { ++ do_lrm_rsc_op(lrm_state, data->rsc, data->input_xml, md); ++ } + free_metadata_cb_data(data); + } + +diff --git a/daemons/controld/controld_execd_state.c b/daemons/controld/controld_execd_state.c +index 8c68bfc..2411297 100644 +--- a/daemons/controld/controld_execd_state.c ++++ b/daemons/controld/controld_execd_state.c +@@ -132,12 +132,6 @@ lrm_state_create(const char *node_name) + return state; + } + +-void +-lrm_state_destroy(const char *node_name) +-{ +- g_hash_table_remove(lrm_state_table, node_name); +-} +- + static gboolean + remote_proxy_remove_by_node(gpointer key, gpointer value, gpointer user_data) + { +@@ -307,7 +301,7 @@ lrm_state_destroy_all(void) + lrm_state_t * + lrm_state_find(const char *node_name) + { +- if (!node_name) { ++ if ((node_name == NULL) || (lrm_state_table == NULL)) { + return NULL; + } + return g_hash_table_lookup(lrm_state_table, node_name); +@@ -318,6 +312,8 @@ lrm_state_find_or_create(const char *node_name) + { + lrm_state_t *lrm_state; + ++ CRM_CHECK(lrm_state_table != NULL, return NULL); ++ + lrm_state = g_hash_table_lookup(lrm_state_table, node_name); + if (!lrm_state) { + lrm_state = lrm_state_create(node_name); +@@ -329,6 +325,9 @@ lrm_state_find_or_create(const char *node_name) + GList * + lrm_state_get_list(void) + { ++ if (lrm_state_table == NULL) { ++ return NULL; ++ } + return g_hash_table_get_values(lrm_state_table); + } + +@@ -799,7 +798,7 @@ lrm_state_unregister_rsc(lrm_state_t * lrm_state, + } + + if (is_remote_lrmd_ra(NULL, NULL, rsc_id)) { +- lrm_state_destroy(rsc_id); ++ g_hash_table_remove(lrm_state_table, rsc_id); + return pcmk_ok; + } + +diff --git a/daemons/controld/controld_lrm.h b/daemons/controld/controld_lrm.h +index 25f3db3..c3113e4 100644 +--- a/daemons/controld/controld_lrm.h ++++ b/daemons/controld/controld_lrm.h +@@ -108,11 +108,6 @@ gboolean lrm_state_init_local(void); + */ + void lrm_state_destroy_all(void); + +-/*! +- * \brief Destroy executor connection by node name +- */ +-void lrm_state_destroy(const char *node_name); +- + /*! + * \brief Find lrm_state data by node name + */ +-- +2.41.0 + diff --git a/Fix-libcrmcommon-wait-for-reply-from-appropriate-con.patch b/Fix-libcrmcommon-wait-for-reply-from-appropriate-con.patch new file mode 100644 index 0000000000000000000000000000000000000000..6189dbd610b332c56a6c8a5df28f3b4b13653c6e --- /dev/null +++ b/Fix-libcrmcommon-wait-for-reply-from-appropriate-con.patch @@ -0,0 +1,95 @@ +From b2cc5110fa35ed8010412391c9bf7673a25cf2ae Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Fri, 25 Aug 2023 15:29:09 +0800 +Subject: [PATCH] Fix: libcrmcommon: wait for reply from appropriate controller + commands + +--- + lib/common/ipc_controld.c | 49 ++++++++++++++------------------------- + 1 file changed, 17 insertions(+), 32 deletions(-) + +diff --git a/lib/common/ipc_controld.c b/lib/common/ipc_controld.c +index 9303afd..993a7b5 100644 +--- a/lib/common/ipc_controld.c ++++ b/lib/common/ipc_controld.c +@@ -177,18 +177,16 @@ set_nodes_data(pcmk_controld_api_reply_t *data, xmlNode *msg_data) + static bool + reply_expected(pcmk_ipc_api_t *api, xmlNode *request) + { +- const char *command = crm_element_value(request, F_CRM_TASK); +- +- if (command == NULL) { +- return false; +- } +- +- // We only need to handle commands that functions in this file can send +- return !strcmp(command, CRM_OP_REPROBE) +- || !strcmp(command, CRM_OP_NODE_INFO) +- || !strcmp(command, CRM_OP_PING) +- || !strcmp(command, CRM_OP_LRM_FAIL) +- || !strcmp(command, CRM_OP_LRM_DELETE); ++ // We only need to handle commands that API functions can send ++ return pcmk__str_any_of(crm_element_value(request, F_CRM_TASK), ++ PCMK__CONTROLD_CMD_NODES, ++ CRM_OP_LRM_DELETE, ++ CRM_OP_LRM_FAIL, ++ CRM_OP_NODE_INFO, ++ CRM_OP_PING, ++ CRM_OP_REPROBE, ++ CRM_OP_RM_NODE_CACHE, ++ NULL); + } + + static bool +@@ -202,22 +200,12 @@ dispatch(pcmk_ipc_api_t *api, xmlNode *reply) + pcmk_controld_reply_unknown, NULL, NULL, + }; + +- /* If we got an ACK, return true so the caller knows to expect more responses +- * from the IPC server. We do this before decrementing replies_expected because +- * ACKs are not going to be included in that value. +- * +- * Note that we cannot do the same kind of status checking here that we do in +- * ipc_pacemakerd.c. The ACK message we receive does not necessarily contain +- * a status attribute. That is, we may receive this: +- * +- * +- * +- * Instead of this: +- * +- * +- */ + if (pcmk__str_eq(crm_element_name(reply), "ack", pcmk__str_none)) { +- return true; // More replies needed ++ /* ACKs are trivial responses that do not count toward expected replies, ++ * and do not have all the fields that validation requires, so skip that ++ * processing. ++ */ ++ return private->replies_expected > 0; + } + + if (private->replies_expected > 0) { +@@ -344,18 +332,15 @@ static int + send_controller_request(pcmk_ipc_api_t *api, xmlNode *request, + bool reply_is_expected) + { +- int rc; +- + if (crm_element_value(request, XML_ATTR_REFERENCE) == NULL) { + return EINVAL; + } +- rc = pcmk__send_ipc_request(api, request); +- if ((rc == pcmk_rc_ok) && reply_is_expected) { ++ if (reply_is_expected) { + struct controld_api_private_s *private = api->api_data; + + private->replies_expected++; + } +- return rc; ++ return pcmk__send_ipc_request(api, request); + } + + static xmlNode * +-- +2.33.0 + diff --git a/Fix-the-validation-function-of-input.patch b/Fix-the-validation-function-of-input.patch new file mode 100644 index 0000000000000000000000000000000000000000..63f65273c1af4227b3890de2d65915f10713879c --- /dev/null +++ b/Fix-the-validation-function-of-input.patch @@ -0,0 +1,25 @@ +From 97f65bfa392b5663e023f5bee46697e778423b55 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 28 Aug 2023 17:02:22 +0800 +Subject: [PATCH] fix the validation function of input + +--- + agents/ocf/HealthCPU.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/agents/ocf/HealthCPU.in b/agents/ocf/HealthCPU.in +index a852a7a..4bd6e36 100755 +--- a/agents/ocf/HealthCPU.in ++++ b/agents/ocf/HealthCPU.in +@@ -207,7 +207,7 @@ meta-data) meta_data + ;; + start) healthcpu_start;; + stop) healthcpu_stop;; +-monitor) healthcpu_monitor;; ++monitor) healthcpu_validate && healthcpu_monitor;; + reload-agent) healthcpu_reload_agent;; + validate-all) healthcpu_validate;; + usage|help) healthcpu_usage +-- +2.33.1.windows.1 + diff --git a/pacemaker.spec b/pacemaker.spec index 037f48929cb253fd7fc6d7433834bf294a120be9..1f485e6201aa1c95026802f946fd298c2212c098 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.6 -%global specversion 1 +%global specversion 6 ## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build %global commit 6fdc9deea294bbad629b003c6ae036aaed8e3ee0 @@ -150,6 +150,13 @@ Url: https://www.clusterlabs.org/ Source0: https://codeload.github.com/%{github_owner}/%{name}/tar.gz/%{archive_github_url} Source1: https://codeload.github.com/%{github_owner}/%{nagios_name}/tar.gz/%{nagios_archive_github_url} +# https://github.com/ClusterLabs/pacemaker/pull/3177 +Patch0: 0001-Fix-glib-assertions.patch +Patch1: 0001-Add-the-parameter-of-dampening-and-fix-attrd_updater.patch +Patch2: 0001-Add-the-parameter-of-dampening-and-fix-attrd_updater-HealthIOWait.patch +Patch3: Fix-libcrmcommon-wait-for-reply-from-appropriate-con.patch +Patch4: Fix-the-validation-function-of-input.patch + # upstream commits Requires: resource-agents @@ -769,6 +776,21 @@ exit 0 %license %{nagios_name}-%{nagios_hash}/COPYING %changelog +* Mon Aug 28 2023 liupei - 2.1.6-6 +- fix the validation function of input for HealthCPU + +* Fri Aug 25 2023 zhanghan - 2.1.6-5 +- Fix: libcrmcommon: wait for reply from appropriate controller commands + +* Wed Aug 23 2023 liupei - 2.1.6-4 +- Add the parameter of attrd_delay and fix attrd_updter command for HealthIOWait + +* Wed Aug 23 2023 liupei - 2.1.6-3 +- Add the parameter of attrd_delay and fix attrd_updter command + +* Mon Aug 21 2023 jiangxinyu - 2.1.6-2 +- Fix glib assertions due to asynchronous metadata action completing after shutdown begins + * Wed May 31 2023 bizhiyuan - 2.1.6-1 - Update package to version 2.1.6