6 # bail if $TESTDIR is not set as this test will fail in that scenario
7 [ -z $TESTDIR ] && { echo "\$TESTDIR needs to be set, but is not. Exiting."; exit 1; }
9 # if HADOOP_PREFIX is not set, use default
10 [ -z $HADOOP_PREFIX ] && { HADOOP_PREFIX=$TESTDIR/hadoop; }
12 # create pools with different replication factors
13 for repl in 2 3 7 8 9; do
15 ceph osd pool create $name 8 8
16 ceph osd pool set $name size $repl
18 id=`ceph osd dump | sed -n "s/^pool \([0-9]*\) '$name'.*/\1/p"`
19 ceph mds add_data_pool $id
22 # create a file in each of the pools
23 for repl in 2 3 7 8 9; do
25 $HADOOP_PREFIX/bin/hadoop fs -rm -f /$name.dat
26 dd if=/dev/zero bs=1048576 count=1 | \
27 $HADOOP_PREFIX/bin/hadoop fs -Dceph.data.pools="$name" \
31 # check that hadoop reports replication matching
32 # that of the pool the file was written into
33 for repl in 2 3 7 8 9; do
35 repl2=$($HADOOP_PREFIX/bin/hadoop fs -ls /$name.dat | awk '{print $2}')
36 if [ $repl -ne $repl2 ]; then
37 echo "replication factors didn't match!"