test/vhost: dont't terminate existing master connection if OS is booted

Terminating master connection will terminate other connections so can't
use test/vhost/common/vm_ssh.sh to connect from two terminals. This
patch terminate master connection only if guest OS is not booted.

Change-Id: I711fed525f1ce813c3aa3d03255a1b32513d24bd
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/421684
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Pawel Wodkowski 2018-08-09 12:26:36 +02:00 committed by Jim Harris
parent f56b230063
commit 94eae4eef5

View File

@ -324,7 +324,7 @@ function vm_ssh()
local ssh_config="$VM_BASE_DIR/ssh_config"
local ssh_cmd="ssh -i $SPDK_VHOST_SSH_KEY_FILE -F $ssh_config \
-p $(vm_ssh_socket $1) 127.0.0.1"
-p $(vm_ssh_socket $1) $VM_SSH_OPTIONS 127.0.0.1"
shift
$ssh_cmd "$@"
@ -386,10 +386,9 @@ function vm_os_booted()
return 1
fi
# Shutdown existing master. Ignore errors as it might not exist.
ssh -O exit -F $VM_BASE_DIR/ssh_config -p $(vm_ssh_socket $1) 127.0.0.1 2> /dev/null || true
if ! vm_ssh $1 "true" 2>/dev/null; then
if ! VM_SSH_OPTIONS="-o ControlMaster=no" vm_ssh $1 "true" 2>/dev/null; then
# Shutdown existing master. Ignore errors as it might not exist.
VM_SSH_OPTIONS="-O exit" vm_ssh $1 "true" 2>/dev/null
return 1
fi