From 2d2f2491ebefd39438b8caa75d0ec1aeb88293a0 Mon Sep 17 00:00:00 2001 From: Shraddha Agrawal Date: Tue, 3 Feb 2026 17:56:18 +0530 Subject: [PATCH] qa/standalone/availability.sh: retry after feature is turned on This commit adds a retry to ensure we wait for availability score to be reported after it is turned on and do not fail early. Fixes: https://tracker.ceph.com/issues/74178 Signed-off-by: Shraddha Agrawal --- qa/standalone/mon/availability.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/qa/standalone/mon/availability.sh b/qa/standalone/mon/availability.sh index c12fa28fd1b..3e636d55b6d 100755 --- a/qa/standalone/mon/availability.sh +++ b/qa/standalone/mon/availability.sh @@ -55,9 +55,12 @@ function TEST_availablity_score() { ceph health | grep HEALTH_OK || return 1 # enable feature ceph config set mon enable_availability_tracking true - - ceph osd pool availability-status - AVAILABILITY_STATUS=$(ceph osd pool availability-status | grep -w "foo") + + # Retry up to 5 times for the pool to show up in availability-status + AVAILABILITY_STATUS="$(wait_for_pool_availability_status foo 5 1)" || { + echo "Failed: availability status not reported for pool foo after enabling (5 retries)" + return 1 + } SCORE=$(echo "$AVAILABILITY_STATUS" | awk '{print $7}') IS_AVAILABLE=$(echo "$AVAILABILITY_STATUS" | awk '{print $8}') UPTIME_DURATION=$(echo "$AVAILABILITY_STATUS" | awk '{print $2}') @@ -85,7 +88,11 @@ function TEST_availablity_score() { # enable feature and check is score updated when it was off ceph config set mon enable_availability_tracking true - AVAILABILITY_STATUS=$(ceph osd pool availability-status | grep -w "foo") + # Retry up to 5 times for the pool to show up in availability-status + AVAILABILITY_STATUS="$(wait_for_pool_availability_status foo 5 1)" || { + echo "Failed: availability status not reported for pool foo after enabling (5 retries)" + return 1 + } UPTIME_DURATION=$(echo "$AVAILABILITY_STATUS" | awk '{print $2}') NEW_UPTIME_SECONDS=$(( ${UPTIME_DURATION%[sm]} * (${UPTIME_DURATION: -1} == "m" ? 60 : 1) )) if [ "$NEW_UPTIME_SECONDS" -gt $((UPTIME_SECONDS + 120)) ]; then @@ -152,4 +159,14 @@ function TEST_availablity_score() { return 0 } +function wait_for_pool_availability_status() { + local pool="$1" + + for _ in {1..5}; do + ceph osd pool availability-status | grep -w "$pool" && return 0 + sleep 1 + done + return 1 +} + main availability "$@" -- 2.47.3