test/vhost: silence some very noisy loops and better checking for ssh
key file When using '-x' option some loops produce huge amount of useless debug logs. It would be good to have different log levels but for now let silence those places. Use 'readlink -e' while checking default ssh keyfile path. This ensure to fail if keyfile is invalid link. Change-Id: I1e24fe02a3e1a1646b710e5e3d8c2ee2c1abf2a4 Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-on: https://review.gerrithub.io/393799 Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
053fbb2300
commit
29e017f406
@ -56,8 +56,8 @@ function notice()
|
|||||||
|
|
||||||
|
|
||||||
# SSH key file
|
# SSH key file
|
||||||
: ${SPDK_VHOST_SSH_KEY_FILE="$HOME/.ssh/spdk_vhost_id_rsa"}
|
: ${SPDK_VHOST_SSH_KEY_FILE="$(readlink -e $HOME/.ssh/spdk_vhost_id_rsa)"}
|
||||||
if [[ ! -e "$SPDK_VHOST_SSH_KEY_FILE" ]]; then
|
if [[ ! -r "$SPDK_VHOST_SSH_KEY_FILE" ]]; then
|
||||||
error "Could not find SSH key file $SPDK_VHOST_SSH_KEY_FILE"
|
error "Could not find SSH key file $SPDK_VHOST_SSH_KEY_FILE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -375,6 +375,9 @@ function vm_kill_all()
|
|||||||
#
|
#
|
||||||
function vm_shutdown_all()
|
function vm_shutdown_all()
|
||||||
{
|
{
|
||||||
|
local shell_restore_x="$( [[ "$-" =~ x ]] && echo 'set -x' )"
|
||||||
|
set +x
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
for vm in $VM_BASE_DIR/[0-9]*; do
|
for vm in $VM_BASE_DIR/[0-9]*; do
|
||||||
vm_shutdown $(basename $vm)
|
vm_shutdown $(basename $vm)
|
||||||
@ -394,6 +397,7 @@ function vm_shutdown_all()
|
|||||||
if [[ $all_vms_down == 1 ]]; then
|
if [[ $all_vms_down == 1 ]]; then
|
||||||
notice "All VMs successfully shut down"
|
notice "All VMs successfully shut down"
|
||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
|
$shell_restore_x
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -401,11 +405,13 @@ function vm_shutdown_all()
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
|
$shell_restore_x
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function vm_setup()
|
function vm_setup()
|
||||||
{
|
{
|
||||||
|
local shell_restore_x="$( [[ "$-" =~ x ]] && echo 'set -x' )"
|
||||||
local OPTIND optchar a
|
local OPTIND optchar a
|
||||||
|
|
||||||
local os=""
|
local os=""
|
||||||
@ -448,10 +454,13 @@ function vm_setup()
|
|||||||
echo "rm -rf $vm_dir"
|
echo "rm -rf $vm_dir"
|
||||||
else
|
else
|
||||||
local vm_dir=""
|
local vm_dir=""
|
||||||
|
|
||||||
|
set +x
|
||||||
for (( i=0; i<=256; i++)); do
|
for (( i=0; i<=256; i++)); do
|
||||||
local vm_dir="$VM_BASE_DIR/$i"
|
local vm_dir="$VM_BASE_DIR/$i"
|
||||||
[[ ! -d $vm_dir ]] && break
|
[[ ! -d $vm_dir ]] && break
|
||||||
done
|
done
|
||||||
|
$shell_restore_x
|
||||||
|
|
||||||
vm_num=$i
|
vm_num=$i
|
||||||
fi
|
fi
|
||||||
@ -495,10 +504,12 @@ function vm_setup()
|
|||||||
local qemu_pid_file="$vm_dir/qemu.pid"
|
local qemu_pid_file="$vm_dir/qemu.pid"
|
||||||
local cpu_num=0
|
local cpu_num=0
|
||||||
|
|
||||||
|
set +x
|
||||||
for ((cpu=0; cpu<$(nproc --all); cpu++))
|
for ((cpu=0; cpu<$(nproc --all); cpu++))
|
||||||
do
|
do
|
||||||
(($task_mask&1<<$cpu)) && ((cpu_num++)) || :
|
(($task_mask&1<<$cpu)) && ((cpu_num++)) || :
|
||||||
done
|
done
|
||||||
|
$shell_restore_x
|
||||||
|
|
||||||
#-cpu host
|
#-cpu host
|
||||||
local node_num=${!qemu_numa_node_param}
|
local node_num=${!qemu_numa_node_param}
|
||||||
@ -673,6 +684,9 @@ function vm_wait_for_boot()
|
|||||||
{
|
{
|
||||||
assert_number $1
|
assert_number $1
|
||||||
|
|
||||||
|
local shell_restore_x="$( [[ "$-" =~ x ]] && echo 'set -x' )"
|
||||||
|
set +x
|
||||||
|
|
||||||
local all_booted=false
|
local all_booted=false
|
||||||
local timeout_time=$1
|
local timeout_time=$1
|
||||||
[[ $timeout_time -lt 10 ]] && timeout_time=10
|
[[ $timeout_time -lt 10 ]] && timeout_time=10
|
||||||
@ -712,11 +726,13 @@ function vm_wait_for_boot()
|
|||||||
warning "LOG not found"
|
warning "LOG not found"
|
||||||
fi
|
fi
|
||||||
warning "================"
|
warning "================"
|
||||||
|
$shell_restore_x
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(date +%s) -gt $timeout_time ]]; then
|
if [[ $(date +%s) -gt $timeout_time ]]; then
|
||||||
error "timeout waiting for machines to boot"
|
warning "timeout waiting for machines to boot"
|
||||||
|
$shell_restore_x
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if (( i > 30 )); then
|
if (( i > 30 )); then
|
||||||
@ -731,6 +747,7 @@ function vm_wait_for_boot()
|
|||||||
done
|
done
|
||||||
|
|
||||||
notice "all VMs ready"
|
notice "all VMs ready"
|
||||||
|
$shell_restore_x
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user