Merge "[ceph-client] update logic of inactive pgs check"
This commit is contained in:
commit
c0b86523a7
@ -29,21 +29,31 @@ if [[ ! -e ${ADMIN_KEYRING} ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function wait_for_inactive_pgs () {
|
function wait_for_pgs () {
|
||||||
echo "#### Start: Checking for inactive pgs ####"
|
echo "#### Start: Checking pgs ####"
|
||||||
|
|
||||||
|
pgs_ready=0
|
||||||
|
query='map({state: .state}) | group_by(.state) | map({state: .[0].state, count: length}) | .[] | select(.state | startswith("active+") | not)'
|
||||||
|
|
||||||
|
if [[ $(ceph tell mon.* version | egrep -q "nautilus"; echo $?) -eq 0 ]]; then
|
||||||
|
query=".pg_stats | ${query}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Loop until all pgs are active
|
# Loop until all pgs are active
|
||||||
if [[ $(ceph tell mon.* version | egrep -q "nautilus"; echo $?) -eq 0 ]]; then
|
while [[ $pgs_ready -lt 3 ]]; do
|
||||||
while [[ `ceph --cluster ${CLUSTER} pg ls | tail -n +2 | head -n -2 | grep -v "active+"` ]]
|
pgs_state=$(ceph --cluster ${CLUSTER} pg ls -f json | jq -c "${query}")
|
||||||
do
|
if [[ $(jq -c '. | select(.state | contains("peering") | not)' <<< "${pgs_state}") ]]; then
|
||||||
sleep 3
|
# If inactive PGs aren't peering, fail
|
||||||
done
|
echo "Failure, found inactive PGs that aren't peering"
|
||||||
else
|
exit 1
|
||||||
while [[ `ceph --cluster ${CLUSTER} pg ls | tail -n +2 | grep -v "active+"` ]]
|
fi
|
||||||
do
|
if [[ "${pgs_state}" ]]; then
|
||||||
sleep 3
|
pgs_ready=0
|
||||||
done
|
else
|
||||||
fi
|
(( pgs_ready+=1 ))
|
||||||
|
fi
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_recovery_flags () {
|
function check_recovery_flags () {
|
||||||
@ -265,5 +275,5 @@ manage_pool {{ .application }} {{ .name }} {{ .replication }} {{ .percent_total_
|
|||||||
ceph --cluster "${CLUSTER}" osd crush tunables {{ .Values.conf.pool.crush.tunables }}
|
ceph --cluster "${CLUSTER}" osd crush tunables {{ .Values.conf.pool.crush.tunables }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
wait_for_inactive_pgs
|
wait_for_pgs
|
||||||
check_recovery_flags
|
check_recovery_flags
|
||||||
|
Loading…
Reference in New Issue
Block a user