On Thu, Oct 15, 2020 at 10:37:01AM +0800, Zhang Yale wrote:
On Thu, Oct 15, 2020 at 09:50:42AM +0800, Wu Fengguang wrote:
How about merging this lib into the test script -- I don't see where it will be shared with others.
Thanks, Fengguang
But your previous review opinion is "Do it separately, don't mix",
Can you point to the relevant email?
I also think it's better to be apart.
Thanks, Yale
On Wed, Oct 14, 2020 at 08:57:20PM +0800, Zhang Yale wrote:
Provide a login port for user, determine whether to send the ssh_port message based on the uuid.
Signed-off-by: Zhang Yale zhangyale3@huawei.com
lib/forward_port.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 lib/forward_port.sh
diff --git a/lib/forward_port.sh b/lib/forward_port.sh new file mode 100755 index 00000000..fa45953b --- /dev/null +++ b/lib/forward_port.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# uuid +# sshr_port_len +# sshr_port_base
+. $LKP_SRC/lib/http.sh
+sshr_ip=$LKP_SERVER +sshr_port=5050 +[ -n "$sshr_port_len" ] || sshr_port_len=2000 +[ -n "$sshr_port_base" ] || sshr_port_base=50000
+get_port() +{
- [ -n "$uuid" ] || return
- for i in $(seq 1 10)
- do
port=$(($(date +%s%N)%"$sshr_port_len"+"$sshr_port_base"))
ssh -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes -o TCPKeepAlive=yes \
-Nf -R $port:localhost:22 sshr@"$sshr_ip" -p "$sshr_port" &>/dev/null
[ $? -eq 0 ] || continue
echo "$port"
break
- done
+}
2.23.0