From 57bce7953f58978e067ffc29f44b9b2551678ee1 Mon Sep 17 00:00:00 2001 From: Pawel Kaminski Date: Mon, 2 Jul 2018 21:37:42 -0400 Subject: [PATCH] test/json: Add rbd bdev test Change-Id: I8d8b252bf826e6339810ccf27a4c68ed6a726af9 Signed-off-by: Pawel Kaminski Reviewed-on: https://review.gerrithub.io/417603 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris --- autotest.sh | 4 ++++ test/bdev/bdevjson/rbd_json_config.sh | 26 ++++++++++++++++++++++++++ test/json_config/common.sh | 10 ++++++++++ 3 files changed, 40 insertions(+) create mode 100755 test/bdev/bdevjson/rbd_json_config.sh diff --git a/autotest.sh b/autotest.sh index d1bc50f77..28ce5a527 100755 --- a/autotest.sh +++ b/autotest.sh @@ -212,6 +212,10 @@ if [ $SPDK_TEST_PMDK -eq 1 ]; then run_test ./test/pmem/json_config/json_config.sh fi +if [ $SPDK_TEST_RBD -eq 1 ]; then + run_test ./test/bdev/bdevjson/rbd_json_config.sh +fi + timing_enter cleanup autotest_cleanup timing_exit cleanup diff --git a/test/bdev/bdevjson/rbd_json_config.sh b/test/bdev/bdevjson/rbd_json_config.sh new file mode 100755 index 000000000..458ecb740 --- /dev/null +++ b/test/bdev/bdevjson/rbd_json_config.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -ex +VHOST_JSON_DIR=$(readlink -f $(dirname $0)) +. $VHOST_JSON_DIR/../../json_config/common.sh + +function test_subsystems() { + run_spdk_tgt + rootdir=$(readlink -f $VHOST_JSON_DIR/../../..) + + rpc_py="$spdk_rpc_py" + clear_config_py="$spdk_clear_config_py" + $rpc_py start_subsystem_init + + create_rbd_bdev_subsystem_config + test_json_config + clear_rbd_bdev_subsystem_config + + kill_targets +} + +trap 'rbd_cleanup; on_error_exit "${FUNCNAME}" "${LINENO}"' ERR +timing_enter rbd_json_config + +test_subsystems +timing_exit rbd_json_config +report_test_completion rbd_json_config diff --git a/test/json_config/common.sh b/test/json_config/common.sh index f9e0370db..43b3edc3c 100644 --- a/test/json_config/common.sh +++ b/test/json_config/common.sh @@ -111,6 +111,16 @@ function clear_pmem_bdev_subsystem_config() { $rpc_py delete_pmem_pool /tmp/pool_file1 } +function create_rbd_bdev_subsystem_config() { + rbd_setup 127.0.0.1 + $rpc_py construct_rbd_bdev $RBD_POOL $RBD_NAME 4096 +} + +function clear_rbd_bdev_subsystem_config() { + $clear_config_py clear_config + rbd_cleanup +} + function create_bdev_subsystem_config() { $rpc_py construct_split_vbdev Nvme0n1 2 $rpc_py construct_null_bdev Null0 32 512