]> git.proxmox.com Git - ceph.git/blobdiff - ceph/qa/standalone/ceph-helpers.sh
update sources to 12.2.8
[ceph.git] / ceph / qa / standalone / ceph-helpers.sh
index 6a8eebff4b4475fcfd1167220a16682e7ba92ddd..f12f0698a7624255d027d840d0e3662aec15d4f0 100755 (executable)
@@ -150,6 +150,7 @@ function test_setup() {
 # subvolumes that relate to it.
 #
 # @param dir path name of the environment
+# @param dumplogs pass "1" to dump logs otherwise it will only if cores found
 # @return 0 on success, 1 on error
 #
 function teardown() {
@@ -169,7 +170,7 @@ function teardown() {
       pattern=""
     fi
     # Local we start with core and teuthology ends with core
-    if ls $(dirname $pattern) | grep -q '^core\|core$' ; then
+    if ls $(dirname "$pattern") | grep -q '^core\|core$' ; then
         cores="yes"
         if [ -n "$LOCALRUN" ]; then
            mkdir /tmp/cores.$$ 2> /dev/null || true
@@ -179,7 +180,13 @@ function teardown() {
         fi
     fi
     if [ "$cores" = "yes" -o "$dumplogs" = "1" ]; then
-        display_logs $dir
+       if [ -n "$LOCALRUN" ]; then
+           display_logs $dir
+        else
+           # Move logs to where Teuthology will archive it
+           mkdir -p $TESTDIR/archive/log
+           mv $dir/*.log $TESTDIR/archive/log
+       fi
     fi
     rm -fr $dir
     rm -rf $(get_asok_dir)
@@ -514,6 +521,11 @@ function create_pool() {
     sleep 1
 }
 
+function delete_pool() {
+    local poolname=$1
+    ceph osd pool delete $poolname $poolname --yes-i-really-really-mean-it
+}
+
 #######################################################################
 
 function run_mgr() {
@@ -1442,10 +1454,11 @@ function test_wait_for_clean() {
 #######################################################################
 
 ##
-# Wait until the cluster becomes HEALTH_OK again or if it does not make progress
-# for $TIMEOUT seconds.
+# Wait until the cluster has health condition passed as arg
+# again for $TIMEOUT seconds.
 #
-# @return 0 if the cluster is HEALTHY, 1 otherwise
+# @param string to grep for in health detail
+# @return 0 if the cluster health matches request, 1 otherwise
 #
 function wait_for_health() {
     local grepstr=$1
@@ -1462,6 +1475,12 @@ function wait_for_health() {
     done
 }
 
+##
+# Wait until the cluster becomes HEALTH_OK again or if it does not make progress
+# for $TIMEOUT seconds.
+#
+# @return 0 if the cluster is HEALTHY, 1 otherwise
+#
 function wait_for_health_ok() {
      wait_for_health "HEALTH_OK" || return 1
 }
@@ -1997,6 +2016,15 @@ function inject_eio() {
     done
 }
 
+function multidiff() {
+    if ! diff $@ ; then
+        if [ "$DIFFCOLOPTS" = "" ]; then
+            return 1
+        fi
+        diff $DIFFCOLOPTS $@
+    fi
+}
+
 # Local Variables:
 # compile-command: "cd ../../src ; make -j4 && ../qa/standalone/ceph-helpers.sh TESTS # test_get_config"
 # End: