Commit f2ad26d9 authored by Karol Latecki's avatar Karol Latecki Committed by Jim Harris
Browse files

hw_hotplug: allow to use custom SSH key



Put the SSH routine into a function and allow to
use custom SSH key by using an optionally set
environment variable.

Signed-off-by: default avatarKarol Latecki <karol.latecki@intel.com>
Change-Id: I6b1f552af9e28ab0b94d027c8848ef0dd5480791
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12339


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
parent 23c86a26
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -4,33 +4,43 @@ testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../..)
source $rootdir/test/common/autotest_common.sh

function beetle_ssh() {
	if [[ -n $BEETLE_SSH_KEY ]]; then
		ssh_opts=" -i $(readlink -f $BEETLE_SSH_KEY)"
	fi

	#shellcheck disable=SC2029
	ssh $ssh_opts root@$ip "$@"
}

function insert_device() {
	ssh root@$ip 'Beetle --SetGpio "$gpio" HIGH'
	beetle_ssh 'Beetle --SetGpio "$gpio" HIGH'
	waitforblk $name
	DRIVER_OVERRIDE=$driver $rootdir/scripts/setup.sh
}

function remove_device() {
	ssh root@$ip 'Beetle --SetGpio "$gpio" LOW'
	beetle_ssh 'Beetle --SetGpio "$gpio" LOW'
}

function restore_device() {
	ssh root@$ip 'Beetle --SetGpio "$gpio" HIGH'
	beetle_ssh 'Beetle --SetGpio "$gpio" HIGH'
}

ip=$1
gpio=$2
driver=$3

declare -i io_time=5
declare -i kernel_hotplug_time=7

timing_enter hotplug_hw_cfg

# Configure microcontroller
ssh root@$ip 'Beetle --SetGpioDirection "$gpio" OUT'
beetle_ssh 'Beetle --SetGpioDirection "$gpio" OUT'

# Get blk dev name connected to interposer
ssh root@$ip 'Beetle --SetGpio "$gpio" HIGH'
beetle_ssh 'Beetle --SetGpio "$gpio" HIGH'
sleep $kernel_hotplug_time
$rootdir/scripts/setup.sh reset
blk_list1=$(lsblk -d --output NAME | grep "^nvme")