diff --git a/autotest.sh b/autotest.sh index 7af77d6e6..378b454ac 100755 --- a/autotest.sh +++ b/autotest.sh @@ -77,12 +77,6 @@ timing_enter nvmf_setup rdma_device_init timing_exit nvmf_setup -if [ $SPDK_TEST_RBD -eq 1 ]; then - timing_enter rbd_setup - rbd_setup - timing_exit rbd_setup -fi - ##################### # Unit Tests ##################### diff --git a/scripts/ceph/ceph.conf b/scripts/ceph/ceph.conf index 13095d988..9cf918e5d 100644 --- a/scripts/ceph/ceph.conf +++ b/scripts/ceph/ceph.conf @@ -34,9 +34,6 @@ mon_osd_max_split_count = 10000 mon_pg_warn_max_per_osd = 10000 -[mon.a] - mon addr = 127.0.0.1:12046 - [osd] osd_op_threads = 64 filestore_queue_max_ops=5000 diff --git a/scripts/ceph/start.sh b/scripts/ceph/start.sh index 28fed0bdf..fbb2e83d1 100755 --- a/scripts/ceph/start.sh +++ b/scripts/ceph/start.sh @@ -7,7 +7,7 @@ set -e script_dir=$(readlink -f $(dirname $0)) base_dir=/var/tmp/ceph -mon_ip=127.0.0.1 +mon_ip=$1 mon_dir=${base_dir}/mon.a/ pid_dir=${base_dir}/pid ceph_conf=${base_dir}/ceph.conf @@ -58,6 +58,9 @@ mount /dev/disk/by-partlabel/osd-device-0-data ${mnt_pt} echo -e "\tosd data = ${mnt_pt}" >> "$ceph_conf" echo -e "\tosd journal = /dev/disk/by-partlabel/osd-device-0-journal" >> "$ceph_conf" +# add mon address +echo -e "\t[mon.a]" >> "$ceph_conf" +echo -e "\tmon addr = ${mon_ip}:12046" >> "$ceph_conf" # create mon rm -rf ${mon_dir}/* diff --git a/test/bdev/blockdev.sh b/test/bdev/blockdev.sh index 85048badd..dcdef04ee 100755 --- a/test/bdev/blockdev.sh +++ b/test/bdev/blockdev.sh @@ -57,6 +57,10 @@ cp $testdir/bdev.conf.in $testdir/bdev.conf $rootdir/scripts/gen_nvme.sh >> $testdir/bdev.conf if [ $SPDK_TEST_RBD -eq 1 ]; then + timing_enter rbd_setup + rbd_setup 127.0.0.1 + timing_exit rbd_setup + $rootdir/scripts/gen_rbd.sh >> $testdir/bdev.conf fi @@ -147,5 +151,7 @@ fi rm -f /tmp/aiofile rm -f /tmp/spdk-pmem-pool rm -f $testdir/bdev.conf +trap - SIGINT SIGTERM EXIT +rbd_cleanup report_test_completion "bdev" timing_exit bdev diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 0fe53b73c..106beb556 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -314,11 +314,17 @@ function start_iscsi_service() { } function rbd_setup() { + # $1 = monitor ip address + if [ -z "$1" ]; then + echo "No monitor IP address provided for ceph" + exit 1 + fi + if hash ceph; then export PG_NUM=128 export RBD_POOL=rbd export RBD_NAME=foo - $rootdir/scripts/ceph/start.sh + $rootdir/scripts/ceph/start.sh $1 ceph osd pool create $RBD_POOL $PG_NUM || true rbd pool init $RBD_POOL || true @@ -577,10 +583,6 @@ function get_bdev_size() function autotest_cleanup() { - if [ $SPDK_TEST_RBD -eq 1 ]; then - rbd_cleanup - fi - $rootdir/scripts/setup.sh reset if [ $SPDK_BUILD_IOAT_KMOD -eq 1 ]; then diff --git a/test/iscsi_tgt/rbd/rbd.sh b/test/iscsi_tgt/rbd/rbd.sh index aec125de8..1a38f3b40 100755 --- a/test/iscsi_tgt/rbd/rbd.sh +++ b/test/iscsi_tgt/rbd/rbd.sh @@ -10,8 +10,12 @@ if ! hash ceph; then exit 0 fi -timing_enter rbd +timing_enter rbd_setup +rbd_setup $TARGET_IP +trap "rbd_cleanup; exit 1" SIGINT SIGTERM EXIT +timing_exit rbd_setup +timing_enter rbd rpc_py="python $rootdir/scripts/rpc.py" fio_py="python $rootdir/scripts/fio.py" @@ -21,7 +25,7 @@ timing_enter start_iscsi_tgt $ISCSI_APP -c $testdir/iscsi.conf -m $ISCSI_TEST_CORE_MASK & pid=$! -trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT +trap "killprocess $pid; rbd_cleanup; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid echo "iscsi_tgt is listening. Running tests..." @@ -42,7 +46,7 @@ sleep 1 iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT -trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT +trap "iscsicleanup; killprocess $pid; rbd_cleanup; exit 1" SIGINT SIGTERM EXIT sleep 1 $fio_py 4096 1 randrw 1 verify @@ -54,6 +58,7 @@ trap - SIGINT SIGTERM EXIT iscsicleanup killprocess $pid +rbd_cleanup report_test_completion "iscsi_rbd" timing_exit rbd