]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: osd-recovery-prio.sh replace sleep with wait for both PGs 38857/head
authorDavid Zafman <dzafman@redhat.com>
Tue, 12 Jan 2021 01:30:00 +0000 (17:30 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 12 Jan 2021 01:30:00 +0000 (17:30 -0800)
recovering

fixes: https://tracker.ceph.com/issues/48842

Signed-off-by: David Zafman <dzafman@redhat.com>
qa/standalone/osd/osd-recovery-prio.sh

index 672b407de900dc977e778b35f9e293d85b24106c..f5d7928c8511b13ab4d81dca436e92abae01c024 100755 (executable)
@@ -425,7 +425,31 @@ function TEST_recovery_pool_priority() {
 
     ceph osd pool set $pool1 size 2
     ceph osd pool set $pool2 size 2
-    sleep 10
+
+    # Wait for both PGs to be in recovering state
+    ceph pg dump pgs
+
+    # Wait for recovery to start
+    set -o pipefail
+    count=0
+    while(true)
+    do
+      if test $(ceph --format json pg dump pgs |
+             jq '.pg_stats | .[] | .state | contains("recovering")' | grep -c true) == "2"
+      then
+        break
+      fi
+      sleep 2
+      if test "$count" -eq "10"
+      then
+        echo "Recovery never started on both PGs"
+        return 1
+      fi
+      count=$(expr $count + 1)
+    done
+    set +o pipefail
+    ceph pg dump pgs
+
     CEPH_ARGS='' ceph --admin-daemon $(get_asok_path osd.${chk_osd1_1}) dump_recovery_reservations > $dir/dump.${chk_osd1_1}.out
     echo osd.${chk_osd1_1}
     cat $dir/dump.${chk_osd1_1}.out