vhost: Move non-function code to top of common.sh

Change-Id: Iae8052b76d2cb1e78a993def689a948935d060f9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454494
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2019-05-10 11:10:28 -07:00 committed by Darek Stojaczyk
parent 73bb5a717f
commit ad25a95cfa

View File

@ -13,6 +13,33 @@ SPDK_BUILD_DIR=$BASE_DIR/../../
SPDK_VHOST_SCSI_TEST_DIR=$TEST_DIR/vhost
# SSH key file
: ${SPDK_VHOST_SSH_KEY_FILE="$(readlink -e $HOME/.ssh/spdk_vhost_id_rsa)"}
if [[ ! -r "$SPDK_VHOST_SSH_KEY_FILE" ]]; then
error "Could not find SSH key file $SPDK_VHOST_SSH_KEY_FILE"
exit 1
fi
echo "Using SSH key file $SPDK_VHOST_SSH_KEY_FILE"
VM_BASE_DIR="$TEST_DIR/vms"
mkdir -p $TEST_DIR
#
# Source config describing QEMU and VHOST cores and NUMA
#
source $BASE_DIR/common/autotest.config
# Trace flag is optional, if it wasn't set earlier - disable it after sourcing
# autotest_common.sh
if [[ $- =~ x ]]; then
source $SPDK_BUILD_DIR/test/common/autotest_common.sh
else
source $SPDK_BUILD_DIR/test/common/autotest_common.sh
set +x
fi
function message()
{
if ! $SPDK_VHOST_VERBOSE; then
@ -55,34 +82,6 @@ function notice()
message "INFO" "$@"
}
# SSH key file
: ${SPDK_VHOST_SSH_KEY_FILE="$(readlink -e $HOME/.ssh/spdk_vhost_id_rsa)"}
if [[ ! -r "$SPDK_VHOST_SSH_KEY_FILE" ]]; then
error "Could not find SSH key file $SPDK_VHOST_SSH_KEY_FILE"
exit 1
fi
echo "Using SSH key file $SPDK_VHOST_SSH_KEY_FILE"
VM_BASE_DIR="$TEST_DIR/vms"
mkdir -p $TEST_DIR
#
# Source config describing QEMU and VHOST cores and NUMA
#
source $BASE_DIR/common/autotest.config
# Trace flag is optional, if it wasn't set earlier - disable it after sourcing
# autotest_common.sh
if [[ $- =~ x ]]; then
source $SPDK_BUILD_DIR/test/common/autotest_common.sh
else
source $SPDK_BUILD_DIR/test/common/autotest_common.sh
set +x
fi
function get_vhost_dir()
{
if [[ ! -z "$1" ]]; then