test/rbd: add configurable monitoring IP address for ceph

Ceph monitor IP address was always 127.0.0.1, with this change
it can be configured at setup time.

Since each test might prefer to specify different addresses
or ones that do not exist at start of autotest.sh. rbd_setup was
moved to begining of each test respectively.

Change-Id: I5626f7ea979d0db921208355ba23314cf48e971f
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/407910
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Tomasz Zawadzki 2018-04-16 09:12:23 -04:00 committed by Daniel Verkamp
parent f34fae94fe
commit 0629b01d21
6 changed files with 25 additions and 18 deletions

View File

@ -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
#####################

View File

@ -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

View File

@ -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}/*

View File

@ -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

View File

@ -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

View File

@ -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