mirror of
https://github.com/ceph/ceph
synced 2025-04-11 04:02:04 +00:00
test: Fix wait_for_state() to wait for a PG to get into a state
To avoid confusion fix function names in osd-backfill-space.sh for how they actually work. Fixes: https://tracker.ceph.com/issues/43592 Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
parent
4cf31062d1
commit
9f7aabbe9f
@ -49,7 +49,7 @@ function get_num_in_state() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function wait_for_state() {
|
function wait_for_not_state() {
|
||||||
local state=$1
|
local state=$1
|
||||||
local num_in_state=-1
|
local num_in_state=-1
|
||||||
local cur_in_state
|
local cur_in_state
|
||||||
@ -78,15 +78,15 @@ function wait_for_state() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function wait_for_backfill() {
|
function wait_for_not_backfilling() {
|
||||||
local timeout=$1
|
local timeout=$1
|
||||||
wait_for_state backfilling $timeout
|
wait_for_not_state backfilling $timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function wait_for_active() {
|
function wait_for_not_activating() {
|
||||||
local timeout=$1
|
local timeout=$1
|
||||||
wait_for_state activating $timeout
|
wait_for_not_state activating $timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
# All tests are created in an environment which has fake total space
|
# All tests are created in an environment which has fake total space
|
||||||
@ -149,8 +149,8 @@ function TEST_backfill_test_simple() {
|
|||||||
done
|
done
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
wait_for_backfill 240 || return 1
|
wait_for_not_backfilling 240 || return 1
|
||||||
wait_for_active 60 || return 1
|
wait_for_not_activating 60 || return 1
|
||||||
|
|
||||||
ERRORS=0
|
ERRORS=0
|
||||||
if [ "$(ceph pg dump pgs | grep +backfill_toofull | wc -l)" != "1" ];
|
if [ "$(ceph pg dump pgs | grep +backfill_toofull | wc -l)" != "1" ];
|
||||||
@ -228,8 +228,8 @@ function TEST_backfill_test_multi() {
|
|||||||
done
|
done
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
wait_for_backfill 240 || return 1
|
wait_for_not_backfilling 240 || return 1
|
||||||
wait_for_active 60 || return 1
|
wait_for_not_activating 60 || return 1
|
||||||
|
|
||||||
ERRORS=0
|
ERRORS=0
|
||||||
full="$(ceph pg dump pgs | grep +backfill_toofull | wc -l)"
|
full="$(ceph pg dump pgs | grep +backfill_toofull | wc -l)"
|
||||||
@ -380,8 +380,8 @@ function TEST_backfill_test_sametarget() {
|
|||||||
ceph osd pool set $pool2 size 2
|
ceph osd pool set $pool2 size 2
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
wait_for_backfill 240 || return 1
|
wait_for_not_backfilling 240 || return 1
|
||||||
wait_for_active 60 || return 1
|
wait_for_not_activating 60 || return 1
|
||||||
|
|
||||||
ERRORS=0
|
ERRORS=0
|
||||||
if [ "$(ceph pg dump pgs | grep +backfill_toofull | wc -l)" != "1" ];
|
if [ "$(ceph pg dump pgs | grep +backfill_toofull | wc -l)" != "1" ];
|
||||||
@ -512,8 +512,8 @@ function TEST_backfill_multi_partial() {
|
|||||||
ceph osd in osd.$fillosd
|
ceph osd in osd.$fillosd
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
wait_for_backfill 240 || return 1
|
wait_for_not_backfilling 240 || return 1
|
||||||
wait_for_active 60 || return 1
|
wait_for_not_activating 60 || return 1
|
||||||
|
|
||||||
flush_pg_stats || return 1
|
flush_pg_stats || return 1
|
||||||
ceph pg dump pgs
|
ceph pg dump pgs
|
||||||
@ -695,8 +695,8 @@ function TEST_ec_backfill_simple() {
|
|||||||
|
|
||||||
ceph pg dump pgs
|
ceph pg dump pgs
|
||||||
|
|
||||||
wait_for_backfill 240 || return 1
|
wait_for_not_backfilling 240 || return 1
|
||||||
wait_for_active 60 || return 1
|
wait_for_not_activating 60 || return 1
|
||||||
|
|
||||||
ceph pg dump pgs
|
ceph pg dump pgs
|
||||||
|
|
||||||
@ -819,8 +819,8 @@ function TEST_ec_backfill_multi() {
|
|||||||
|
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
wait_for_backfill 240 || return 1
|
wait_for_not_backfilling 240 || return 1
|
||||||
wait_for_active 60 || return 1
|
wait_for_not_activating 60 || return 1
|
||||||
|
|
||||||
ceph pg dump pgs
|
ceph pg dump pgs
|
||||||
|
|
||||||
@ -958,8 +958,8 @@ function SKIP_TEST_ec_backfill_multi_partial() {
|
|||||||
sleep 30
|
sleep 30
|
||||||
ceph pg dump pgs
|
ceph pg dump pgs
|
||||||
|
|
||||||
wait_for_backfill 240 || return 1
|
wait_for_not_backfilling 240 || return 1
|
||||||
wait_for_active 60 || return 1
|
wait_for_not_activating 60 || return 1
|
||||||
|
|
||||||
ceph pg dump pgs
|
ceph pg dump pgs
|
||||||
|
|
||||||
@ -1066,8 +1066,8 @@ function SKIP_TEST_ec_backfill_multi_partial() {
|
|||||||
ceph osd in osd.$fillosd
|
ceph osd in osd.$fillosd
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
wait_for_backfill 240 || return 1
|
wait_for_not_backfilling 240 || return 1
|
||||||
wait_for_active 60 || return 1
|
wait_for_not_activating 60 || return 1
|
||||||
|
|
||||||
ERRORS=0
|
ERRORS=0
|
||||||
if [ "$(ceph pg dump pgs | grep -v "^1.0" | grep +backfill_toofull | wc -l)" != "1" ];
|
if [ "$(ceph pg dump pgs | grep -v "^1.0" | grep +backfill_toofull | wc -l)" != "1" ];
|
||||||
|
@ -49,7 +49,6 @@ function get_num_in_state() {
|
|||||||
|
|
||||||
function wait_for_state() {
|
function wait_for_state() {
|
||||||
local state=$1
|
local state=$1
|
||||||
local num_in_state=-1
|
|
||||||
local cur_in_state
|
local cur_in_state
|
||||||
local -a delays=($(get_timeout_delays $2 5))
|
local -a delays=($(get_timeout_delays $2 5))
|
||||||
local -i loop=0
|
local -i loop=0
|
||||||
@ -61,11 +60,8 @@ function wait_for_state() {
|
|||||||
|
|
||||||
while true ; do
|
while true ; do
|
||||||
cur_in_state=$(get_num_in_state ${state})
|
cur_in_state=$(get_num_in_state ${state})
|
||||||
test $cur_in_state = "0" && break
|
test $cur_in_state -gt 0 && break
|
||||||
if test $cur_in_state != $num_in_state ; then
|
if (( $loop >= ${#delays[*]} )) ; then
|
||||||
loop=0
|
|
||||||
num_in_state=$cur_in_state
|
|
||||||
elif (( $loop >= ${#delays[*]} )) ; then
|
|
||||||
ceph pg dump pgs
|
ceph pg dump pgs
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user