From 734d2f77dca551d9e9148f5e6c0d3305badc467e Mon Sep 17 00:00:00 2001 From: bixiaoyan Date: Fri, 22 Nov 2024 14:11:06 +0800 Subject: [PATCH] storage_mon: remove unused macro variables; High: storage-mon: Fixed a bug in storage-mon's daemon mode that delayed the reflection of initial scores, and made it compliant with OCF specifications. --- ...-Correct-the-timing-of-setting-notif.patch | 49 +++++++++++++++++++ ...RA-Wait-until-monitor-confirms-the-s.patch | 35 +++++++++++++ ...n-remove-unused-macro-variables-1994.patch | 26 ++++++++++ resource-agents.spec | 10 +++- 4 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 backport-High-storage-mon-Correct-the-timing-of-setting-notif.patch create mode 100644 backport-Mid-storage-mon-RA-Wait-until-monitor-confirms-the-s.patch create mode 100644 backport-storage_mon-remove-unused-macro-variables-1994.patch diff --git a/backport-High-storage-mon-Correct-the-timing-of-setting-notif.patch b/backport-High-storage-mon-Correct-the-timing-of-setting-notif.patch new file mode 100644 index 0000000..fd8b3b0 --- /dev/null +++ b/backport-High-storage-mon-Correct-the-timing-of-setting-notif.patch @@ -0,0 +1,49 @@ +From 46715c638829598d949dffab0898fe4c07074895 Mon Sep 17 00:00:00 2001 +From: Hideo Yamauchi +Date: Thu, 21 Nov 2024 15:21:19 +0900 +Subject: [PATCH 4/5] High: storage-mon: Correct the timing of setting + notification values to storage-mon(RA) clients. + +--- + tools/storage_mon.c | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +diff --git a/tools/storage_mon.c b/tools/storage_mon.c +index 2519a9e7..27d2ff1d 100644 +--- a/tools/storage_mon.c ++++ b/tools/storage_mon.c +@@ -320,7 +320,14 @@ static int32_t sigchld_handler(int32_t sig, void *data) + + finished_count++; + test_forks[index] = 0; +- ++ ++ /* Update the result value for the client response once all checks have completed. */ ++ if (device_count == finished_count) { ++ response_final_score = final_score; ++ if (!daemon_check_first_all_devices) { ++ daemon_check_first_all_devices = TRUE; ++ } ++ } + } + } + } else { +@@ -441,15 +448,7 @@ static int test_device_main(gpointer data) + if (is_child_runnning()) { + device_check = FALSE; + } +- +- if (device_count == finished_count && device_check) { +- /* Update the result value for the client response once all checks have completed. */ +- response_final_score = final_score; + +- if (!daemon_check_first_all_devices) { +- daemon_check_first_all_devices = TRUE; +- } +- } + } + + if (device_check) { +-- +2.25.1 + diff --git a/backport-Mid-storage-mon-RA-Wait-until-monitor-confirms-the-s.patch b/backport-Mid-storage-mon-RA-Wait-until-monitor-confirms-the-s.patch new file mode 100644 index 0000000..7f3d431 --- /dev/null +++ b/backport-Mid-storage-mon-RA-Wait-until-monitor-confirms-the-s.patch @@ -0,0 +1,35 @@ +From 1201390fb219d1b566c5d31463daacef60c31ab4 Mon Sep 17 00:00:00 2001 +From: Hideo Yamauchi +Date: Thu, 21 Nov 2024 15:43:33 +0900 +Subject: [PATCH 5/5] Mid: storage-mon RA: Wait until monitor confirms the + startup pid according to the OCF resource specification. + +--- + heartbeat/storage-mon.in | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/heartbeat/storage-mon.in b/heartbeat/storage-mon.in +index 284dec30..7c9943d4 100644 +--- a/heartbeat/storage-mon.in ++++ b/heartbeat/storage-mon.in +@@ -325,6 +325,17 @@ storage-mon_start() { + if [ "$?" -ne 0 ]; then + return $OCF_ERR_GENERIC + fi ++ ++ #Wait until monitor confirms the startup pid according to the ocf resource specification. ++ while true; do ++ storage-mon_monitor pid_check_only ++ rc="$?" ++ if [ $rc -eq $OCF_SUCCESS ]; then ++ break ++ fi ++ sleep 1 ++ ocf_log debug "storage-mon daemon still hasn't started yet. Waiting..." ++ done + fi + } + +-- +2.25.1 + diff --git a/backport-storage_mon-remove-unused-macro-variables-1994.patch b/backport-storage_mon-remove-unused-macro-variables-1994.patch new file mode 100644 index 0000000..06bdac2 --- /dev/null +++ b/backport-storage_mon-remove-unused-macro-variables-1994.patch @@ -0,0 +1,26 @@ +From 20a433c39ceff08c91316695fa2e99519a4ed302 Mon Sep 17 00:00:00 2001 +From: Fujii Masao +Date: Tue, 12 Nov 2024 17:00:46 +0900 +Subject: [PATCH 3/5] storage_mon: remove unused macro variables (#1994) + +--- + tools/storage_mon.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/tools/storage_mon.c b/tools/storage_mon.c +index f94268f6..2519a9e7 100644 +--- a/tools/storage_mon.c ++++ b/tools/storage_mon.c +@@ -33,9 +33,6 @@ + #define DEFAULT_PIDFILE HA_VARRUNDIR "storage_mon.pid" + #define DEFAULT_ATTRNAME "#health-storage_mon" + #define SMON_GET_RESULT_COMMAND "get_check_value" +-#define SMON_RESULT_OK "green" +-#define SMON_RESULT_NG "red" +-#define SMON_RESULT_COMMAND_ERROR "unknown command" + #define SMON_BUFF_1MEG 1048576 + #define SMON_MAX_IPCSNAME 256 + #define SMON_MAX_MSGSIZE 128 +-- +2.25.1 + diff --git a/resource-agents.spec b/resource-agents.spec index 3cb0df2..1e06589 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -1,11 +1,13 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.16.0 -Release: 1 +Release: 2 License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: https://github.com/ClusterLabs/resource-agents/releases/tag/v%{version}.tar.gz - +Patch0000: backport-High-storage-mon-Correct-the-timing-of-setting-notif.patch +Patch0001: backport-storage_mon-remove-unused-macro-variables-1994.patch +Patch0002: backport-Mid-storage-mon-RA-Wait-until-monitor-confirms-the-s.patch Obsoletes: heartbeat-resources <= %{version} Provides: heartbeat-resources = %{version} BuildRequires: automake autoconf pkgconfig gcc perl-interpreter perl-generators python3-devel @@ -103,6 +105,10 @@ export CFLAGS="$(echo '%{optflags}')" %{_mandir}/man8/{ocf-tester.8*,ldirectord.8*} %changelog +* Fri Nov 22 2024 bixiaoyan - 4.16.0-2 +- High: storage-mon: Fixed a bug in storage-mon's daemon mode that delayed the reflection of initial scores, and made it compliant with OCF specifications +- Storage_mon: remove unused macro variables + * Thu Nov 14 2024 bixiaoyan - 4.16.0-1 - update version to 4.16.0 -- Gitee