]> git.proxmox.com Git - ceph.git/blobdiff - ceph/qa/workunits/rbd/journal.sh
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / qa / workunits / rbd / journal.sh
index 60b5a41038f15c87973ae3a77cb22cc902eecc4c..ba89e75c92641b2a113a65fc800b5ad558fb4e7c 100755 (executable)
@@ -1,4 +1,5 @@
-#!/bin/bash -e
+#!/usr/bin/env bash
+set -e
 
 . $(dirname $0)/../../standalone/ceph-helpers.sh
 
@@ -12,7 +13,7 @@ function list_tests()
 
 function usage()
 {
-  echo "usage: $0 [-h|-l|-t <testname> [-t <testname>...] [--no-sanity-check] [--no-cleanup]]"
+  echo "usage: $0 [-h|-l|-t <testname> [-t <testname>...] [--no-cleanup]]"
 }
 
 function expect_false()
@@ -69,7 +70,7 @@ test_rbd_journal()
 
     local count=10
     save_commit_position ${journal}
-    rbd bench-write ${image} --io-size 4096 --io-threads 1 \
+    rbd bench --io-type write ${image} --io-size 4096 --io-threads 1 \
        --io-total $((4096 * count)) --io-pattern seq
     rbd journal status --image ${image} | fgrep "tid=$((count - 1))"
     restore_commit_position ${journal}
@@ -95,16 +96,17 @@ test_rbd_journal()
     rbd snap create ${image1}@test
     restore_commit_position ${journal1}
     # check that commit position is properly updated: the journal should contain
-    # 12 entries (10 AioWrite + 1 SnapCreate + 1 OpFinish) and commit
-    # position set to tid=11
+    # 14 entries (2 AioFlush + 10 AioWrite + 1 SnapCreate + 1 OpFinish) and
+    # commit position set to tid=14
     rbd journal inspect --image ${image1} --verbose | awk '
+      /AioFlush/          {a++}         # match: "event_type": "AioFlush",
       /AioWrite/          {w++}         # match: "event_type": "AioWrite",
       /SnapCreate/        {s++}         # match: "event_type": "SnapCreate",
       /OpFinish/          {f++}         # match: "event_type": "OpFinish",
-      /entries inspected/ {t=$1; e=$4}  # match: 12 entries inspected, 0 errors
+      /entries inspected/ {t=$1; e=$4}  # match: 14 entries inspected, 0 errors
                           {print}       # for diagnostic
       END                 {
-        if (w != 10 || s != 1 || f != 1 || t != 12 || e != 0) exit(1)
+        if (a != 2 || w != 10 || s != 1 || f != 1 || t != 14 || e != 0) exit(1)
       }
     '
 
@@ -170,6 +172,30 @@ test_rbd_copy()
     rbd remove ${image}
 }
 
+test_rbd_deep_copy()
+{
+    local src=testrbdcopys$$
+    rbd create --size 256 ${src}
+    rbd snap create ${src}@snap1
+
+    local dest=testrbdcopy$$
+    rbd deep copy --image-feature exclusive-lock --image-feature journaling \
+        --journal-pool rbd \
+        --journal-object-size 20M \
+        --journal-splay-width 6 \
+        ${src} ${dest}
+
+    rbd snap purge ${src}
+    rbd remove ${src}
+
+    rbd_assert_eq ${dest} 'journal info' '//journal/order' 25
+    rbd_assert_eq ${dest} 'journal info' '//journal/splay_width' 6
+    rbd_assert_eq ${dest} 'journal info' '//journal/object_pool' rbd
+
+    rbd snap purge ${dest}
+    rbd remove ${dest}
+}
+
 test_rbd_clone()
 {
     local parent=testrbdclonep$$
@@ -247,7 +273,6 @@ TESTS+=" rbd_feature"
 
 tests_to_run=()
 
-sanity_check=true
 cleanup=true
 
 while [[ $# -gt 0 ]]; do
@@ -257,9 +282,6 @@ while [[ $# -gt 0 ]]; do
        "-l" )
            do_list=1
            ;;
-       "--no-sanity-check" )
-           sanity_check=false
-           ;;
        "--no-cleanup" )
            cleanup=false
            ;;
@@ -296,15 +318,9 @@ if test -z "$tests_to_run" ; then
 fi
 
 for i in $tests_to_run; do
-    if $sanity_check ; then
-       wait_for_clean
-    fi
     set -x
     test_${i}
     set +x
 done
-if $sanity_check ; then
-    wait_for_clean
-fi
 
 echo OK