test/iscsi: wait for tgt termination before creating new node

If the process doesn't terminate before we try to create a new iscsi
node, the socket might still be in use by that process causing the
`bind()` call to fail.

Fixes #2052.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ic6c32774b3c3d7008b1089f151fc933177f28aac
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8902
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
Konrad Sztyber 2021-07-22 14:03:41 +02:00 committed by Tomasz Zawadzki
parent be4e9db783
commit 84b304ce57

View File

@ -9,6 +9,7 @@ iscsitestinit
rpc_py="$rootdir/scripts/rpc.py"
fio_py="$rootdir/scripts/fio-wrapper"
pids=()
source "$rootdir/test/common/applications.sh"
NETMASK=127.0.0.0/24
@ -35,6 +36,7 @@ function iscsi_tgt_start() {
"${ISCSI_APP[@]}" -r $1 -m $2 --wait-for-rpc &
pid=$!
echo "Process pid: $pid"
pids+=($pid)
trap 'kill_all_iscsi_target; exit 1' SIGINT SIGTERM EXIT
@ -74,6 +76,7 @@ fiopid=$!
sleep 3
$rpc_py -s $rpc_first_addr spdk_kill_instance SIGTERM
wait ${pids[0]}
rpc_add_target_node $rpc_second_addr
@ -84,4 +87,5 @@ trap - SIGINT SIGTERM EXIT
iscsicleanup
$rpc_py -s $rpc_second_addr spdk_kill_instance SIGTERM
wait ${pids[1]}
iscsitestfini