1
0
mirror of https://github.com/ceph/ceph synced 2025-03-25 11:48:05 +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:
David Zafman 2020-01-13 17:29:11 -08:00
parent 4cf31062d1
commit 9f7aabbe9f
2 changed files with 23 additions and 27 deletions

View File

@ -49,7 +49,7 @@ function get_num_in_state() {
}
function wait_for_state() {
function wait_for_not_state() {
local state=$1
local num_in_state=-1
local cur_in_state
@ -78,15 +78,15 @@ function wait_for_state() {
}
function wait_for_backfill() {
function wait_for_not_backfilling() {
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
wait_for_state activating $timeout
wait_for_not_state activating $timeout
}
# All tests are created in an environment which has fake total space
@ -149,8 +149,8 @@ function TEST_backfill_test_simple() {
done
sleep 30
wait_for_backfill 240 || return 1
wait_for_active 60 || return 1
wait_for_not_backfilling 240 || return 1
wait_for_not_activating 60 || return 1
ERRORS=0
if [ "$(ceph pg dump pgs | grep +backfill_toofull | wc -l)" != "1" ];
@ -228,8 +228,8 @@ function TEST_backfill_test_multi() {
done
sleep 30
wait_for_backfill 240 || return 1
wait_for_active 60 || return 1
wait_for_not_backfilling 240 || return 1
wait_for_not_activating 60 || return 1
ERRORS=0
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
sleep 30
wait_for_backfill 240 || return 1
wait_for_active 60 || return 1
wait_for_not_backfilling 240 || return 1
wait_for_not_activating 60 || return 1
ERRORS=0
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
sleep 30
wait_for_backfill 240 || return 1
wait_for_active 60 || return 1
wait_for_not_backfilling 240 || return 1
wait_for_not_activating 60 || return 1
flush_pg_stats || return 1
ceph pg dump pgs
@ -695,8 +695,8 @@ function TEST_ec_backfill_simple() {
ceph pg dump pgs
wait_for_backfill 240 || return 1
wait_for_active 60 || return 1
wait_for_not_backfilling 240 || return 1
wait_for_not_activating 60 || return 1
ceph pg dump pgs
@ -819,8 +819,8 @@ function TEST_ec_backfill_multi() {
sleep 30
wait_for_backfill 240 || return 1
wait_for_active 60 || return 1
wait_for_not_backfilling 240 || return 1
wait_for_not_activating 60 || return 1
ceph pg dump pgs
@ -958,8 +958,8 @@ function SKIP_TEST_ec_backfill_multi_partial() {
sleep 30
ceph pg dump pgs
wait_for_backfill 240 || return 1
wait_for_active 60 || return 1
wait_for_not_backfilling 240 || return 1
wait_for_not_activating 60 || return 1
ceph pg dump pgs
@ -1066,8 +1066,8 @@ function SKIP_TEST_ec_backfill_multi_partial() {
ceph osd in osd.$fillosd
sleep 30
wait_for_backfill 240 || return 1
wait_for_active 60 || return 1
wait_for_not_backfilling 240 || return 1
wait_for_not_activating 60 || return 1
ERRORS=0
if [ "$(ceph pg dump pgs | grep -v "^1.0" | grep +backfill_toofull | wc -l)" != "1" ];

View File

@ -49,7 +49,6 @@ function get_num_in_state() {
function wait_for_state() {
local state=$1
local num_in_state=-1
local cur_in_state
local -a delays=($(get_timeout_delays $2 5))
local -i loop=0
@ -61,11 +60,8 @@ function wait_for_state() {
while true ; do
cur_in_state=$(get_num_in_state ${state})
test $cur_in_state = "0" && break
if test $cur_in_state != $num_in_state ; then
loop=0
num_in_state=$cur_in_state
elif (( $loop >= ${#delays[*]} )) ; then
test $cur_in_state -gt 0 && break
if (( $loop >= ${#delays[*]} )) ; then
ceph pg dump pgs
return 1
fi