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 rdma_device_init
timing_exit nvmf_setup timing_exit nvmf_setup
timing_enter rbd_setup
rbd_setup
timing_exit rbd_setup
##################### #####################
# Unit Tests # Unit Tests
##################### #####################
@ -113,6 +117,7 @@ run_test test/nvmf/nvme_cli/nvme_cli.sh
timing_exit nvmf timing_exit nvmf
timing_enter cleanup timing_enter cleanup
rbd_cleanup
./scripts/setup.sh reset ./scripts/setup.sh reset
./scripts/build_kmod.sh clean ./scripts/build_kmod.sh clean
timing_exit cleanup timing_exit cleanup

View File

@ -159,6 +159,23 @@ function start_iscsi_service() {
fi 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() { function run_test() {
echo "************************************" echo "************************************"
echo "START TEST $1" echo "START TEST $1"

View File

@ -4,20 +4,11 @@ testdir=$(readlink -f $(dirname $0))
rootdir=$testdir/../../.. rootdir=$testdir/../../..
source $rootdir/scripts/autotest_common.sh 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 if [ ! -d $CEPH_DIR ]; then
echo "Ceph directory not detected on this system; skipping RBD tests" echo "Ceph directory not detected on this system; skipping RBD tests"
exit 0 exit 0
fi 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 if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment" echo "TARGET_IP not defined in environment"
exit 1 exit 1
@ -73,6 +64,5 @@ trap - SIGINT SIGTERM EXIT
iscsicleanup iscsicleanup
killprocess $pid killprocess $pid
(cd $CEPH_DIR && sh -x ../src/stop.sh || true)
timing_exit rbd timing_exit rbd