From b7f1ec6c2ec25c51f4d5961e13068b5983913f68 Mon Sep 17 00:00:00 2001 From: Brandon Kim Date: Mon, 19 Apr 2021 15:18:10 -0700 Subject: meta-quanta: gbs: Add retry to read-margin-temp-wait.sh Add 3 x 1 second retries for WCTemp and default to a sane WCTemp if 0 is read. Signed-off-by: Brandon Kim Change-Id: Ia87e704d2e5e0990a0727cd37290084f8eda2df6 --- .../fans/read-margin-temp/read-margin-temp-wait.sh | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh index 992e40a716..8dd408799e 100644 --- a/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh +++ b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh @@ -27,13 +27,28 @@ for ((i = 0; i < 16; i++)); do Present | awk '{print $2}')" if [[ "$presentState" == "true" ]]; then - wcTemp="$( - busctl get-property xyz.openbmc_project.nvme.manager \ - ${nvmePath}${i} \ - xyz.openbmc_project.Sensor.Threshold.Critical \ - CriticalHigh | awk '{print $2}' - )" - wcTemp="$((wcTemp * 1000))" + actualWCTemp=0 + for ((j = 0; j < 3; j++)); do + actualWCTemp="$( + busctl get-property xyz.openbmc_project.nvme.manager \ + ${nvmePath}${i} \ + xyz.openbmc_project.Sensor.Threshold.Critical \ + CriticalHigh | awk '{print $2}' + )" + if [[ "${actualWCTemp}" -ne 0 ]]; then + break + fi + + echo "${nvmePath}${i} WCTemp was read to be 0, retrying after 1 sec sleep" + sleep 1 + done + + if [[ "${actualWCTemp}" -eq 0 ]]; then + echo "${nvmePath}${i} WCTemp was read to be 0, setting to default WCTemp: ${wcTemp}" + actualWCTemp="${wcTemp}" + fi + + wcTemp="$((actualWCTemp * 1000))" if [[ -z "$nvmeList" ]]; then nvmeList="\"nvme"${i}"\"" else -- cgit v1.2.3