test/vhost: Let users pass command line arguments to vhost_run

Change-Id: Ia5df6e74048ae9b4690fcfd9debf17718777c6ea
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461388
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-06-05 12:44:29 -07:00 committed by Jim Harris
parent 10a0f053c9
commit cefe9145e4
4 changed files with 7 additions and 34 deletions

View File

@ -120,24 +120,11 @@ function vhost_list_all()
function vhost_run() function vhost_run()
{ {
local param
local vhost_num="$1" local vhost_num="$1"
local memory=1024
assert_number "$vhost_num" assert_number "$vhost_num"
shift shift
for param in "$@"; do
case $param in
--memory=*) local memory=${param#*=} ;;
--no-pci*) local no_pci="-u" ;;
*)
error "Invalid parameter '$param'"
return 1
;;
esac
done
local vhost_dir="$(get_vhost_dir $vhost_num)" local vhost_dir="$(get_vhost_dir $vhost_num)"
local vhost_app="$rootdir/app/vhost/vhost" local vhost_app="$rootdir/app/vhost/vhost"
local vhost_log_file="$vhost_dir/vhost.log" local vhost_log_file="$vhost_dir/vhost.log"
@ -153,18 +140,7 @@ function vhost_run()
return 1 return 1
fi fi
local reactor_mask="vhost_${vhost_num}_reactor_mask" local cmd="$vhost_app -r $vhost_dir/rpc.sock $2"
reactor_mask="${!reactor_mask}"
local master_core="vhost_${vhost_num}_master_core"
master_core="${!master_core}"
if [[ -z "$reactor_mask" ]] || [[ -z "$master_core" ]]; then
error "Parameters vhost_${vhost_num}_reactor_mask or vhost_${vhost_num}_master_core not found in autotest.config file"
return 1
fi
local cmd="$vhost_app -m $reactor_mask -p $master_core -s $memory -r $vhost_dir/rpc.sock $no_pci"
notice "Loging to: $vhost_log_file" notice "Loging to: $vhost_log_file"
notice "Socket: $vhost_socket" notice "Socket: $vhost_socket"

View File

@ -86,8 +86,8 @@ function migration_tc2_configure_vhost()
# Run nvmf_tgt and two vhost instances: # Run nvmf_tgt and two vhost instances:
# nvmf_tgt uses core id 2 (-m 0x4) # nvmf_tgt uses core id 2 (-m 0x4)
# First uses core id 0 (vhost_0_reactor_mask=0x1) # First uses core id 0
# Second uses core id 1 (vhost_1_reactor_mask=0x2) # Second uses core id 1
# This force to use VM 1 and 2. # This force to use VM 1 and 2.
timing_enter start_nvmf_tgt timing_enter start_nvmf_tgt
notice "Running nvmf_tgt..." notice "Running nvmf_tgt..."
@ -102,11 +102,8 @@ function migration_tc2_configure_vhost()
$rootdir/scripts/gen_nvme.sh --json | $rpc_nvmf load_subsystem_config $rootdir/scripts/gen_nvme.sh --json | $rpc_nvmf load_subsystem_config
timing_exit start_nvmf_tgt timing_exit start_nvmf_tgt
vhost_run 0 --memory=512 --no-pci vhost_run 0 "-m 0x1 -s 512 -u"
# Those are global intentionally vhost_run 1 "-m 0x2 -s 512 -u"
vhost_1_reactor_mask=0x2
vhost_1_master_core=1
vhost_run 1 --memory=512 --no-pci
local rdma_ip_list=$(get_available_rdma_ips) local rdma_ip_list=$(get_available_rdma_ips)
local nvmf_target_ip=$(echo "$rdma_ip_list" | head -n 1) local nvmf_target_ip=$(echo "$rdma_ip_list" | head -n 1)

View File

@ -122,7 +122,7 @@ function host1_start_vhost()
notice "Starting vhost0 instance on local server" notice "Starting vhost0 instance on local server"
trap 'host1_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT trap 'host1_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
vhost_run 0 --no-pci vhost_run 0 "-u"
$rpc_0 construct_nvme_bdev -b Nvme0 -t rdma -f ipv4 -a $RDMA_TARGET_IP -s 4420 -n "nqn.2018-02.io.spdk:cnode1" $rpc_0 construct_nvme_bdev -b Nvme0 -t rdma -f ipv4 -a $RDMA_TARGET_IP -s 4420 -n "nqn.2018-02.io.spdk:cnode1"
$rpc_0 construct_vhost_scsi_controller $incoming_vm_ctrlr $rpc_0 construct_vhost_scsi_controller $incoming_vm_ctrlr
$rpc_0 add_vhost_scsi_lun $incoming_vm_ctrlr 0 Nvme0n1 $rpc_0 add_vhost_scsi_lun $incoming_vm_ctrlr 0 Nvme0n1

View File

@ -33,7 +33,7 @@ function host_2_start_vhost()
notice "Starting vhost 1 instance on remote server" notice "Starting vhost 1 instance on remote server"
trap 'host_2_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT trap 'host_2_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
vhost_run --vhost-num=1 --no-pci vhost_run 1 "-u"
$rpc construct_nvme_bdev -b Nvme0 -t rdma -f ipv4 -a $RDMA_TARGET_IP -s 4420 -n "nqn.2018-02.io.spdk:cnode1" $rpc construct_nvme_bdev -b Nvme0 -t rdma -f ipv4 -a $RDMA_TARGET_IP -s 4420 -n "nqn.2018-02.io.spdk:cnode1"
$rpc construct_vhost_scsi_controller $target_vm_ctrl $rpc construct_vhost_scsi_controller $target_vm_ctrl