From: Kefu Chai Date: Fri, 19 Jun 2015 15:15:58 +0000 (+0800) Subject: test: add a test to exercise ceph-monstore-update-crush.sh X-Git-Tag: v9.1.0~527^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9d8b6d8532c658e9f14c9a31de2818d263514880;p=ceph.git test: add a test to exercise ceph-monstore-update-crush.sh Fixes: #11815 Signed-off-by: Kefu Chai --- diff --git a/src/test/mon/osd-crush.sh b/src/test/mon/osd-crush.sh index 0a42b6474f34..748f15730b04 100755 --- a/src/test/mon/osd-crush.sh +++ b/src/test/mon/osd-crush.sh @@ -237,6 +237,47 @@ function TEST_crush_tree() { $XMLSTARLET val -e -r test/mon/osd-crush-tree.rng - || return 1 } +# NB: disable me if i am too time consuming +function TEST_crush_repair_faulty_crushmap() { + local dir=$1 + fsid=$(uuidgen) + MONA=127.0.0.1:7113 + MONB=127.0.0.1:7114 + MONC=127.0.0.1:7115 + CEPH_ARGS_orig=$CEPH_ARGS + CEPH_ARGS="--fsid=$fsid --auth-supported=none " + CEPH_ARGS+="--mon-initial-members=a,b,c " + CEPH_ARGS+="--mon-host=$MONA,$MONB,$MONC " + run_mon $dir a --public-addr $MONA || return 1 + run_mon $dir b --public-addr $MONB || return 1 + run_mon $dir c --public-addr $MONC || return 1 + + local empty_map=$dir/empty_map + :> $empty_map.txt + ./crushtool -c $empty_map.txt -o $empty_map.map || return 1 + + local crushtool_path_old=`ceph-conf --show-config-value crushtool` + ceph tell mon.* injectargs --crushtool "true" + + ceph osd setcrushmap -i $empty_map.map || return 1 + # should be an empty crush map without any buckets + ! test $(ceph osd crush dump --format=xml | \ + $XMLSTARLET sel -t -m "//buckets/bucket" -v .) || return 1 + # bring them down, the "ceph" commands will try to hunt for other monitor in + # vain, after mon.a is offline + kill_daemons $dir || return 1 + # rewrite the monstore with the good crush map, + ./tools/ceph-monstore-update-crush.sh --rewrite $dir/a || return 1 + + run_mon $dir a --public-addr $MONA || return 1 + run_mon $dir b --public-addr $MONB || return 1 + run_mon $dir c --public-addr $MONC || return 1 + # the buckets are back + test $(ceph osd crush dump --format=xml | \ + $XMLSTARLET sel -t -m "//buckets/bucket" -v .) || return 1 + CEPH_ARGS=$CEPH_ARGS_orig +} + main osd-crush "$@" # Local Variables: