test: move RBD test pool setup to autotest.sh

Leave the RBD pool configured and running throughout the tests so that
it can be used in multiple test scripts.

Change-Id: I056ef29bd8d97fa63f1ca78ee728f9c51f4bdf41
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-11-16 11:18:40 -07:00
parent 93dfce27d6
commit 19d56fead7
3 changed files with 22 additions and 10 deletions

View File

@ -65,6 +65,10 @@ timing_enter nvmf_setup
rdma_device_init
timing_exit nvmf_setup
timing_enter rbd_setup
rbd_setup
timing_exit rbd_setup
#####################
# Unit Tests
#####################
@ -113,6 +117,7 @@ run_test test/nvmf/nvme_cli/nvme_cli.sh
timing_exit nvmf
timing_enter cleanup
rbd_cleanup
./scripts/setup.sh reset
./scripts/build_kmod.sh clean
timing_exit cleanup

View File

@ -159,6 +159,23 @@ function start_iscsi_service() {
fi
}
function rbd_setup() {
export CEPH_DIR=/home/sys_sgsw/ceph/build
if [ -d $CEPH_DIR ]; then
export RBD_POOL=rbd
export RBD_NAME=foo
(cd $CEPH_DIR && ../src/vstart.sh -d -n -x -l)
/usr/local/bin/rbd create $RBD_NAME --size 1000
fi
}
function rbd_cleanup() {
if [ -d $CEPH_DIR ]; then
(cd $CEPH_DIR && ../src/stop.sh || true)
fi
}
function run_test() {
echo "************************************"
echo "START TEST $1"

View File

@ -4,20 +4,11 @@ testdir=$(readlink -f $(dirname $0))
rootdir=$testdir/../../..
source $rootdir/scripts/autotest_common.sh
CEPH_DIR=/home/sys_sgsw/ceph/build
# RBD pool name and RBD name
RBD_POOL=rbd
RBD_NAME=foo
if [ ! -d $CEPH_DIR ]; then
echo "Ceph directory not detected on this system; skipping RBD tests"
exit 0
fi
(cd $CEPH_DIR && ../src/vstart.sh -d -n -x -l)
/usr/local/bin/rbd create $RBD_NAME --size 1000
if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment"
exit 1
@ -73,6 +64,5 @@ trap - SIGINT SIGTERM EXIT
iscsicleanup
killprocess $pid
(cd $CEPH_DIR && sh -x ../src/stop.sh || true)
timing_exit rbd