!57 Adding parameter check in HealthSMART

From: @bixiaoyan1 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
This commit is contained in:
openeuler-ci-bot 2023-12-07 07:34:23 +00:00 committed by Gitee
commit 20594008e0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,67 @@
From b0d133b3931295c12421e56b798e5deb3a83a060 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 7 Dec 2023 15:00:05 +0800
Subject: [PATCH] fix HealthSMART parameter check
---
agents/ocf/HealthSMART.in | 41 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/agents/ocf/HealthSMART.in b/agents/ocf/HealthSMART.in
index b6edac2..3b15339 100755
--- a/agents/ocf/HealthSMART.in
+++ b/agents/ocf/HealthSMART.in
@@ -136,29 +136,30 @@ END
#######################################################################
check_temperature() {
+ if [ -n "$1" ]; then
+ if [ $1 -lt ${lower_red_limit} ] ; then
+ ocf_log info "Drive ${DRIVE} ${DEVICE} too cold: ${1} C"
+ attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}"
+ return 1
+ fi
- if [ $1 -lt ${lower_red_limit} ] ; then
- ocf_log info "Drive ${DRIVE} ${DEVICE} too cold: ${1} C"
- attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}"
- return 1
- fi
-
- if [ $1 -gt ${upper_red_limit} ] ; then
- ocf_log info "Drive ${DRIVE} ${DEVICE} too hot: ${1} C"
- attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}"
- return 1
- fi
+ if [ $1 -gt ${upper_red_limit} ] ; then
+ ocf_log info "Drive ${DRIVE} ${DEVICE} too hot: ${1} C"
+ attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}"
+ return 1
+ fi
- if [ $1 -lt ${lower_yellow_limit} ] ; then
- ocf_log info "Drive ${DRIVE} ${DEVICE} quite cold: ${1} C"
- attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}"
- return 1
- fi
+ if [ $1 -lt ${lower_yellow_limit} ] ; then
+ ocf_log info "Drive ${DRIVE} ${DEVICE} quite cold: ${1} C"
+ attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}"
+ return 1
+ fi
- if [ $1 -gt ${upper_yellow_limit} ] ; then
- ocf_log info "Drive ${DRIVE} ${DEVICE} quite hot: ${1} C"
- attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}"
- return 1
+ if [ $1 -gt ${upper_yellow_limit} ] ; then
+ ocf_log info "Drive ${DRIVE} ${DEVICE} quite hot: ${1} C"
+ attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}"
+ return 1
+ fi
fi
}
--
2.33.0

View File

@ -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 10
%global specversion 11
## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build
%global commit 6fdc9deea294bbad629b003c6ae036aaed8e3ee0
@ -160,6 +160,7 @@ Patch5: Fix-the-validation-function-of-input.patch
Patch6: Fix-a-bug-in-clone-resource-description-display.patch
Patch7: Fix-controller-not-check-watchdog-fencing-status.patch
Patch8: fix-the-validation-function-of-input-for-IOWait.patch
Patch9: fix-HealthSMART-parameter-check.patch
# upstream commits
Requires: resource-agents
@ -779,6 +780,9 @@ exit 0
%license %{nagios_name}-%{nagios_hash}/COPYING
%changelog
* Thu Dec 07 2023 bixiaoyan <bixiaoyan@kylinos.cn> - 2.1.6-11
- Adding parameter check in HealthSMART
* Tue Nov 28 2023 liupei <liupei@kylinos.cn> - 2.1.6-10
- fix the validation function of input for IOWait