6bef902ca5
RPC is a default feature required for almost all usages, so enable RPC by default, but with a UNIX domain socket for security reasons. -r can now be used from the command line to specify an alternative RPC listen address from the default /var/tmp/spdk.sock. Remove the Enable parameter from the Rpc config section but still allow specifying an alternative listen address using the Listen parameter as an alternative to the command line option. This keeps backward compatibility for this release for anyone using the configuration file still. Remove the Rpc sections from all configuration files that were using them, except for those that specified alternate TCP ports for multi-process test cases. We can fix these later to use an alternate UNIX domain socket and to use the command line instead. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Ife0d03fcab638c67b659f1eb85348ddc2b55c4c4 Reviewed-on: https://review.gerrithub.io/386561 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
110 lines
2.3 KiB
Bash
110 lines
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
BASE_DIR=$(readlink -f $(dirname $0))
|
|
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../ && pwd)"
|
|
rpc_py="$TEST_DIR/scripts/rpc.py "
|
|
|
|
source $TEST_DIR/scripts/autotest_common.sh
|
|
|
|
# Prints error message and return error code, closes vhost app and remove
|
|
# pmem pool file
|
|
# input: error message, error code
|
|
function error()
|
|
{
|
|
local error_code=${2:-1}
|
|
echo "==========="
|
|
echo -e "ERROR: $1"
|
|
echo "error code: $error_code"
|
|
echo "==========="
|
|
vhost_kill
|
|
pmem_clean_pool_file
|
|
return $error_code
|
|
}
|
|
|
|
# check if there is pool file & remove it
|
|
# input: path to pool file
|
|
# default: $TEST_DIR/test/pmem/pool_file
|
|
function pmem_clean_pool_file()
|
|
{
|
|
local pool_file=${1:-$TEST_DIR/test/pmem/pool_file}
|
|
|
|
if [ -f $pool_file ]; then
|
|
echo "Deleting old pool_file"
|
|
rm $pool_file
|
|
fi
|
|
}
|
|
|
|
# create new pmem file
|
|
# input: path to pool file, size in MB, block_size
|
|
# default: $TEST_DIR/test/pmem/pool_file 32 512
|
|
function pmem_create_pool_file()
|
|
{
|
|
local pool_file=${1:-$TEST_DIR/test/pmem/pool_file}
|
|
local size=${2:-32}
|
|
local block_size=${3:-512}
|
|
|
|
pmem_clean_pool_file $pool_file
|
|
echo "Creating new pool file"
|
|
if ! $rpc_py create_pmem_pool $pool_file $size $block_size; then
|
|
error "Creating pool_file failed!"
|
|
fi
|
|
|
|
if [ ! -f $pool_file ]; then
|
|
error "Creating pool_file failed!"
|
|
fi
|
|
}
|
|
|
|
function pmem_unmount_ramspace
|
|
{
|
|
if [ -d "$TEST_DIR/test/pmem/ramspace" ]; then
|
|
if mount | grep -q "$TEST_DIR/test/pmem/ramspace"; then
|
|
umount $TEST_DIR/test/pmem/ramspace
|
|
fi
|
|
|
|
rm -rf $TEST_DIR/test/pmem/ramspace
|
|
fi
|
|
}
|
|
|
|
function pmem_print_tc_name
|
|
{
|
|
echo ""
|
|
echo "==============================================================="
|
|
echo "Now running: $1"
|
|
echo "==============================================================="
|
|
}
|
|
|
|
function vhost_start()
|
|
{
|
|
local vhost_pid
|
|
|
|
$TEST_DIR/app/vhost/vhost &
|
|
if [ $? != 0 ]; then
|
|
echo -e "ERROR: Failed to launch vhost!"
|
|
return 1
|
|
fi
|
|
|
|
vhost_pid=$!
|
|
echo $vhost_pid > $TEST_DIR/test/pmem/vhost.pid
|
|
waitforlisten $vhost_pid
|
|
}
|
|
|
|
function vhost_kill()
|
|
{
|
|
local vhost_pid_file="$TEST_DIR/test/pmem/vhost.pid"
|
|
local vhost_pid="$(cat $vhost_pid_file)"
|
|
|
|
if [[ ! -f $TEST_DIR/test/pmem/vhost.pid ]]; then
|
|
echo -e "ERROR: No vhost pid file found!"
|
|
return 1
|
|
fi
|
|
|
|
if ! kill -s INT $vhost_pid; then
|
|
echo -e "ERROR: Failed to exit vhost / invalid pid!"
|
|
rm $vhost_pid_file
|
|
return 1
|
|
fi
|
|
|
|
sleep 1
|
|
rm $vhost_pid_file
|
|
}
|