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 <karol.latecki@intel.com> Change-Id: I6b1f552af9e28ab0b94d027c8848ef0dd5480791 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12339 Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-by: Ben Walker <benjamin.walker@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:
parent
23c86a2610
commit
f2ad26d9ca
@ -4,33 +4,43 @@ testdir=$(readlink -f $(dirname $0))
|
|||||||
rootdir=$(readlink -f $testdir/../..)
|
rootdir=$(readlink -f $testdir/../..)
|
||||||
source $rootdir/test/common/autotest_common.sh
|
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() {
|
function insert_device() {
|
||||||
ssh root@$ip 'Beetle --SetGpio "$gpio" HIGH'
|
beetle_ssh 'Beetle --SetGpio "$gpio" HIGH'
|
||||||
waitforblk $name
|
waitforblk $name
|
||||||
DRIVER_OVERRIDE=$driver $rootdir/scripts/setup.sh
|
DRIVER_OVERRIDE=$driver $rootdir/scripts/setup.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_device() {
|
function remove_device() {
|
||||||
ssh root@$ip 'Beetle --SetGpio "$gpio" LOW'
|
beetle_ssh 'Beetle --SetGpio "$gpio" LOW'
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_device() {
|
function restore_device() {
|
||||||
ssh root@$ip 'Beetle --SetGpio "$gpio" HIGH'
|
beetle_ssh 'Beetle --SetGpio "$gpio" HIGH'
|
||||||
}
|
}
|
||||||
|
|
||||||
ip=$1
|
ip=$1
|
||||||
gpio=$2
|
gpio=$2
|
||||||
driver=$3
|
driver=$3
|
||||||
|
|
||||||
declare -i io_time=5
|
declare -i io_time=5
|
||||||
declare -i kernel_hotplug_time=7
|
declare -i kernel_hotplug_time=7
|
||||||
|
|
||||||
timing_enter hotplug_hw_cfg
|
timing_enter hotplug_hw_cfg
|
||||||
|
|
||||||
# Configure microcontroller
|
# Configure microcontroller
|
||||||
ssh root@$ip 'Beetle --SetGpioDirection "$gpio" OUT'
|
beetle_ssh 'Beetle --SetGpioDirection "$gpio" OUT'
|
||||||
|
|
||||||
# Get blk dev name connected to interposer
|
# Get blk dev name connected to interposer
|
||||||
ssh root@$ip 'Beetle --SetGpio "$gpio" HIGH'
|
beetle_ssh 'Beetle --SetGpio "$gpio" HIGH'
|
||||||
sleep $kernel_hotplug_time
|
sleep $kernel_hotplug_time
|
||||||
$rootdir/scripts/setup.sh reset
|
$rootdir/scripts/setup.sh reset
|
||||||
blk_list1=$(lsblk -d --output NAME | grep "^nvme")
|
blk_list1=$(lsblk -d --output NAME | grep "^nvme")
|
||||||
|
Loading…
Reference in New Issue
Block a user