From f2ad26d9ca136129a202799313a9109fb935dce2 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Fri, 22 Apr 2022 13:15:48 +0200 Subject: [PATCH] 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: Karol Latecki Change-Id: I6b1f552af9e28ab0b94d027c8848ef0dd5480791 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12339 Reviewed-by: Konrad Sztyber Reviewed-by: Krzysztof Karas Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI --- test/nvme/hw_hotplug.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test/nvme/hw_hotplug.sh b/test/nvme/hw_hotplug.sh index a0891230b..19984ad9b 100755 --- a/test/nvme/hw_hotplug.sh +++ b/test/nvme/hw_hotplug.sh @@ -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")