]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/rbd: small fixup and improvements for rbd-mirror tests
authorMykola Golub <mgolub@mirantis.com>
Thu, 28 Jul 2016 11:49:37 +0000 (14:49 +0300)
committerNathan Cutler <ncutler@suse.com>
Sun, 29 Jan 2017 20:31:45 +0000 (21:31 +0100)
- log to stderr;
- log status if a `wait_for` function failed;
- don't needlessly sleep in `wait_for` functions after the last
  unsuccessful iteration;
- make `wait_for_pool_images` work for image removal case;
- fix `wait_for_pool_images` reset timeout (last_count set).

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
(cherry picked from commit fdb971a2660111d35f0a3077f17a9ca85ca2ef54)

qa/workunits/rbd/rbd_mirror_helpers.sh
qa/workunits/rbd/rbd_mirror_stress.sh

index 78784f5d1c59a108339193eabd8a2bee56cfc21a..a658da254d107433059f2fd47914dd138e5efd2d 100755 (executable)
@@ -105,7 +105,7 @@ daemon_pid_file()
 
 testlog()
 {
-    echo $(date '+%F %T') $@ | tee -a "${TEMPDIR}/rbd-mirror.test.log"
+    echo $(date '+%F %T') $@ | tee -a "${TEMPDIR}/rbd-mirror.test.log" >&2
 }
 
 expect_failure()
@@ -467,7 +467,7 @@ test_status_in_pool_dir()
 
     local status_log=${TEMPDIR}/${cluster}-${image}.mirror_status
     rbd --cluster ${cluster} -p ${pool} mirror image status ${image} |
-       tee ${status_log}
+       tee ${status_log} >&2
     grep "state: .*${state_pattern}" ${status_log}
     grep "description: .*${description_pattern}" ${status_log}
 }
index fe0f608ddc166f5d71288bec471a74297dd5c4f8..aabc5dbc20858bbe2a613e83ab4bf2fd888d9d94 100755 (executable)
@@ -51,17 +51,18 @@ wait_for_pool_images()
 
     while true; do
         for s in `seq 1 40`; do
+            test $s -ne 1 && sleep 30
             count=$(rbd --cluster ${cluster} -p ${pool} mirror pool status | grep 'images: ' | cut -d' ' -f 2)
             test "${count}" = "${image_count}" && return 0
 
             # reset timeout if making forward progress
-            test $count -gt $last_count && break
-            sleep 30
+            test $count -ne $last_count && break
         done
 
-        test $count -eq $last_count && return 1
-        $last_count=$count
+        test $count -eq $last_count && break
+        last_count=$count
     done
+    rbd --cluster ${cluster} -p ${pool} mirror pool status --verbose >&2
     return 1
 }
 
@@ -73,11 +74,12 @@ wait_for_pool_healthy()
     local state
 
     for s in `seq 1 40`; do
+        test $s -ne 1 && sleep 30
         state=$(rbd --cluster ${cluster} -p ${pool} mirror pool status | grep 'health:' | cut -d' ' -f 2)
-        test "${state}" = "ERROR" && return 1
+        test "${state}" = "ERROR" && break
         test "${state}" = "OK" && return 0
-       sleep 30
     done
+    rbd --cluster ${cluster} -p ${pool} mirror pool status --verbose >&2
     return 1
 }