]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: timeout if flush_pg_stats() takes too long 15620/head
authorKefu Chai <kchai@redhat.com>
Mon, 12 Jun 2017 10:33:27 +0000 (18:33 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 12 Jun 2017 11:32:11 +0000 (19:32 +0800)
a "timeout" which defaults to 300 seconds is added to flush_pg_stats()

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/workunits/ceph-helpers.sh

index fe2b9d2232c851604ee363348e57d90b9fa9d815..2e9a5d47d1d80d42e94645f14e7b72b0a08c8971 100755 (executable)
@@ -1638,18 +1638,24 @@ function test_wait_background() {
 
 function flush_pg_stats()
 {
+    local timeout=${1:-$TIMEOUT}
+
     ids=`ceph osd ls`
     seqs=''
     for osd in $ids; do
            seq=`ceph tell osd.$osd flush_pg_stats`
            seqs="$seqs $osd-$seq"
     done
+
     for s in $seqs; do
            osd=`echo $s | cut -d - -f 1`
            seq=`echo $s | cut -d - -f 2`
            echo "waiting osd.$osd seq $seq"
            while test $(ceph osd last-stat-seq $osd) -lt $seq; do
             sleep 1
+            if [ $((timeout--)) -eq 0 ]; then
+                return 1
+            fi
         done
     done
 }