[ceph-osd] Check inactive PGs multiple times

The PS updates post apply job and allows to check multiple times
inactive PGs that are not peering. The wait_for_pgs() function
fails after 10 sequential positive checks.

Change-Id: I98359894477c8e3556450b60b25d62773666b034
This commit is contained in:
Kabanov, Dmitrii 2020-11-02 16:24:24 -08:00 committed by Dmitrii Kabanov
parent 7c8ca55ac0
commit 011e5876c0
2 changed files with 10 additions and 4 deletions

View File

@ -15,6 +15,6 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Ceph OSD
name: ceph-osd
version: 0.1.8
version: 0.1.9
home: https://github.com/ceph/ceph
...

View File

@ -86,6 +86,7 @@ function wait_for_pgs () {
echo "#### Start: Checking pgs ####"
pgs_ready=0
pgs_inactive=0
query='map({state: .state}) | group_by(.state) | map({state: .[0].state, count: length}) | .[] | select(.state | contains("active") | not)'
if [[ $(ceph tell mon.* version | egrep -q "nautilus"; echo $?) -eq 0 ]]; then
@ -96,9 +97,14 @@ function wait_for_pgs () {
while [[ $pgs_ready -lt 3 ]]; do
pgs_state=$(ceph --cluster ${CLUSTER} pg ls -f json | jq -c "${query}")
if [[ $(jq -c '. | select(.state | contains("peering") | not)' <<< "${pgs_state}") ]]; then
# If inactive PGs aren't peering, fail
echo "Failure, found inactive PGs that aren't peering"
exit 1
if [[ pgs_inactive -gt 10 ]]; then
# If inactive PGs aren't peering, fail
echo "Failure, found inactive PGs that aren't peering"
exit 1
fi
(( pgs_inactive+=1 ))
else
pgs_inactive=0
fi
if [[ "${pgs_state}" ]]; then
pgs_ready=0