]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Fix wait_for_state() to wait for a PG to get into a state 32628/head
authorDavid Zafman <dzafman@redhat.com>
Tue, 14 Jan 2020 01:29:11 +0000 (17:29 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 14 Jan 2020 02:39:38 +0000 (18:39 -0800)
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>
qa/standalone/osd/osd-backfill-space.sh
qa/standalone/osd/osd-recovery-space.sh

index cd3f8dff9210bffdb97aad4e436e8d2a30b9f737..3978668eae23c8bdd07a7c84213d3b8b7feba851 100755 (executable)
@@ -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" ];
index d12494a90cafba3570b59070838110a1e3bc6696..82cdf82e5733a065789f928a346a2c5171e1a71d 100755 (executable)
@@ -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