]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/osd/osd-dup.sh: filestore -> bluestore conversion test 14210/head
authorSage Weil <sage@redhat.com>
Wed, 29 Mar 2017 02:19:11 +0000 (22:19 -0400)
committerSage Weil <sage@redhat.com>
Wed, 29 Mar 2017 02:23:44 +0000 (22:23 -0400)
Pretty basic; just verifies the osd restarts and scrub
doesn't immediately turn up problems.

Signed-off-by: Sage Weil <sage@redhat.com>
src/test/osd/CMakeLists.txt
src/test/osd/osd-dup.sh [new file with mode: 0755]

index 35e07ad3e7178f428c4f7e8a9747bcc6e3282c25..f5985dc542830e6f3205039e2dff5449cc97c4b1 100644 (file)
@@ -27,6 +27,7 @@ add_ceph_test(osd-scrub-repair.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-scrub-repair.s
 add_ceph_test(osd-scrub-snaps.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-scrub-snaps.sh)
 add_ceph_test(osd-copy-from.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-copy-from.sh)
 add_ceph_test(osd-fast-mark-down.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-fast-mark-down.sh)
+add_ceph_test(osd-dup.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-dup.sh)
 
 # unittest_osdmap
 add_executable(unittest_osdmap
diff --git a/src/test/osd/osd-dup.sh b/src/test/osd/osd-dup.sh
new file mode 100755 (executable)
index 0000000..d096114
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+source $(dirname $0)/../detect-build-env-vars.sh
+source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
+
+function run() {
+    local dir=$1
+    shift
+
+    export CEPH_MON="127.0.0.1:7146" # git grep '\<7146\>' : there must be only one
+    export CEPH_ARGS
+    CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
+    CEPH_ARGS+="--mon-host=$CEPH_MON "
+    CEPH_ARGS+="--enable-experimental-unrecoverable-data-corrupting-features bluestore "
+    local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
+    for func in $funcs ; do
+        setup $dir || return 1
+        $func $dir || return 1
+        teardown $dir || return 1
+    done
+}
+
+function TEST_filestore_to_bluestore() {
+    local dir=$1
+
+    run_mon $dir a || return 1
+    run_osd $dir 0 || return 1
+    osd_pid=$(cat $dir/osd.0.pid)
+    run_osd $dir 1 || return 1
+    run_osd $dir 2 || return 1
+
+    sleep 5
+
+    ceph osd pool create foo 16
+
+    # write some objects
+    rados bench -p foo 10 write -b 4096 --no-cleanup || return 1
+
+    # kill
+    while kill $osd_pid; do sleep 1 ; done
+    ceph osd down 0
+
+    mv $dir/0 $dir/0.old || return 1
+    mkdir $dir/0 || return 1
+    ofsid=$(cat $dir/0.old/fsid)
+    echo "osd fsid $ofsid"
+    O=$CEPH_ARGS
+    CEPH_ARGS+="--log-file $dir/cot.log --log-max-recent 0 "
+    ceph-objectstore-tool --type bluestore --data-path $dir/0 --fsid $ofsid \
+                         --op mkfs || return 1
+    ceph-objectstore-tool --data-path $dir/0.old --target-data-path $dir/0 \
+                         --op dup || return 1
+    CEPH_ARGS=$O
+
+    run_osd $dir 0 || return 1
+
+    while ! ceph osd stat | grep '3 up' ; do sleep 1 ; done
+    ceph osd metadata 0 | grep bluestore || return 1
+
+    ceph osd scrub 0
+
+    # give it some time
+    sleep 15
+
+    ceph -s | grep '20 active+clean' || return 1
+}
+
+main osd-dup "$@"
+
+# Local Variables:
+# compile-command: "cd ../.. ; make -j4 && test/osd/osd-dup.sh"
+# End: