Ceph-client: update pg validation in helm tests.
This is to update the logic to check for incomplete pgs in ceph cluster and proceed if there are no incomplete/inactive pgs and will not wait for healthy ceph cluster. Change-Id: I026d6cc378053e805680c31d75fdfb40bbb636f5
This commit is contained in:
parent
5e88d9d636
commit
897ebbc75c
@ -27,7 +27,6 @@ function check_cluster_status() {
|
|||||||
echo "Ceph status is HEALTH_OK"
|
echo "Ceph status is HEALTH_OK"
|
||||||
else
|
else
|
||||||
echo "Ceph cluster status is NOT HEALTH_OK."
|
echo "Ceph cluster status is NOT HEALTH_OK."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,31 +186,15 @@ function pool_failuredomain_validation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pg_validation() {
|
function pg_validation() {
|
||||||
echo "#### Start: Checking placement groups active+clean ####"
|
inactive_pgs=(`ceph --cluster ${CLUSTER} pg ls | tail -n +2 | grep -v "active+"|awk '{ print $1 }'`)
|
||||||
|
if [ ${#inactive_pgs[*]} -gt 0 ];then
|
||||||
num_pgs=$(echo ${PG_STAT} | jq -r .num_pgs)
|
echo "There are few incomplete pgs in the cluster"
|
||||||
npoolls=$(echo ${PG_STAT} | jq -r .num_pg_by_state | jq length)
|
echo ${inactive_pgs[*]}
|
||||||
i=$[npoolls-1]
|
exit 1
|
||||||
for n in $(seq 0 ${i})
|
fi
|
||||||
do
|
|
||||||
pg_state=$(echo ${PG_STAT} | jq -r .num_pg_by_state[${n}].name)
|
|
||||||
if [ "xactive+clean" == "x${pg_state}" ]; then
|
|
||||||
active_clean_pg_num=$(echo ${PG_STAT} | jq -r .num_pg_by_state[${n}].num)
|
|
||||||
if [ $num_pgs -eq $active_clean_pg_num ]; then
|
|
||||||
echo "Success: All PGs configured (${num_pgs}) are in active+clean status"
|
|
||||||
else
|
|
||||||
echo "Error: All PGs configured (${num_pgs}) are NOT in active+clean status"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Error: PG state not in active+clean status"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
check_cluster_status
|
|
||||||
check_osd_count
|
check_osd_count
|
||||||
mgr_validation
|
mgr_validation
|
||||||
|
|
||||||
@ -222,3 +205,4 @@ PG_STAT=$(ceph pg stat -f json-pretty)
|
|||||||
pg_validation
|
pg_validation
|
||||||
pool_validation
|
pool_validation
|
||||||
pool_failuredomain_validation
|
pool_failuredomain_validation
|
||||||
|
check_cluster_status
|
||||||
|
Loading…
Reference in New Issue
Block a user