Reuse code to save remote ssh calls

There were 2 identical remote calls to systool.
The output of the first call can be used to save the second one.

Change-Id: Ia6bb75a2606aa47d9a759738452326010ab856dd
This commit is contained in:
Isaac Beckman 2016-07-27 16:39:42 +03:00
parent 28d88d0bf2
commit fac0b2fd8f

View File

@ -134,8 +134,7 @@ function is_device_online() {
# string as a result of the following command. # string as a result of the following command.
cmd="systool -c fc_host -v" cmd="systool -c fc_host -v"
OUTPUT=$(ssh -i $PROVIDER_KEY $PROVIDER_USER@$HYPERVISOR "systool -c fc_host -v") OUTPUT=$(ssh -i $PROVIDER_KEY $PROVIDER_USER@$HYPERVISOR "systool -c fc_host -v")
test_fc_online="systool -c fc_host -v | grep -B12 'Online' | grep 'Class Device path' | grep '$fc_device'" ONLINE=`echo "$OUTPUT" | grep -B12 'Online' | grep 'Class Device path' | grep $fc_device`
ONLINE=$(ssh -i $PROVIDER_KEY $PROVIDER_USER@$HYPERVISOR "$test_fc_online")
echo "online result='$ONLINE'" echo "online result='$ONLINE'"
if [ -z "$ONLINE" ]; then if [ -z "$ONLINE" ]; then
return 0; return 0;