[ofa-general] Re: [PATCH] infiniband-diags/scripts: Fix Bug 239 Error Reporting

David McMillen davem at systemfabricworks.com
Sun Aug 5 17:17:30 PDT 2007


Sasha Khapyorsky wrote:

>Hi David,
>
>On 19:09 Tue 31 Jul     , davem at systemfabricworks.com wrote:
>  
>
>>   Fix Bug 239 OpenIB diag scripts don't return error when lacking umad
>>   permissions.  Returning the error from the head of a shell pipeline is a
>>   problem, so this fix causes the awk scripts to pass error messages through.
>>   This will pass all standard error messages.
>>
>>   This patch needs [ofa-general] [PATCH] infiniband-diags: Add common flags
>>   -P, -C, and -t (posted Tue Jul 31 13:39:27 PDT 2007) applied first.
>>
>>Signed-off-by: David A. McMillen <davem at systemfabricworks.com>
>>---
>> infiniband-diags/scripts/ibcheckerrors.in    |   11 +++++++++--
>> infiniband-diags/scripts/ibcheckerrs.in      |   13 ++++++++++---
>> infiniband-diags/scripts/ibchecknet.in       |   16 ++++++++++++++--
>> infiniband-diags/scripts/ibcheckport.in      |   11 +++++++++--
>> infiniband-diags/scripts/ibcheckportstate.in |   11 +++++++++--
>> infiniband-diags/scripts/ibcheckportwidth.in |   11 +++++++++--
>> infiniband-diags/scripts/ibcheckstate.in     |   10 +++++++++-
>> infiniband-diags/scripts/ibcheckwidth.in     |   10 +++++++++-
>> infiniband-diags/scripts/ibclearcounters.in  |   10 +++++++++-
>> infiniband-diags/scripts/ibclearerrors.in    |   10 +++++++++-
>> infiniband-diags/scripts/ibdatacounters.in   |   11 +++++++++--
>> infiniband-diags/scripts/ibdatacounts.in     |   11 +++++++++--
>> infiniband-diags/scripts/ibhosts.in          |    9 ++++++++-
>> infiniband-diags/scripts/ibrouters.in        |    9 ++++++++-
>> infiniband-diags/scripts/ibswitches.in       |    9 ++++++++-
>> 15 files changed, 138 insertions(+), 24 deletions(-)
>>
>>diff --git a/infiniband-diags/scripts/ibcheckerrors.in b/infiniband-diags/scripts/ibcheckerrors.in
>>index 01c7a99..ebf44ec 100644
>>--- a/infiniband-diags/scripts/ibcheckerrors.in
>>+++ b/infiniband-diags/scripts/ibcheckerrors.in
>>@@ -73,7 +73,9 @@ else
>> 	netcmd="$IBPATH/ibnetdiscover $ca_info"
>> fi
>> 
>>-eval $netcmd | awk '
>>+text="`eval $netcmd`"
>>+rv=$?
>>+echo "$text" | awk '
>> BEGIN {
>> 	ne=0
>> }
>>    
>>
>
>Wouldn't it be simpler just exit instead of running awk over already
>broken output?
>
>Like:
>
>	if [ $rv -ne 0 ] ; then
>		echo $test
>		exit $rv
>	fi
>
>	echo $text | awk ...
>
>Sasha
>
>  
>

Upon failure, sending the full output of the eval'd expression to 
standard output is not very useful, especially since the normal output 
of the various scripts is to suppress most of that.  However, embedded 
within the text there are likely to be error messages that explain what 
went wrong, which is why there are new parts to the awk script catching 
/^ib/ /ibpanic:/ /ibwarn:/ /iberror:/ and passing them through..  
Running awk over already broken output has been happening all along with 
these scripts, so it does not create a new problem.

We could define two awk scripts, one for success and one for failure, 
but I think that is more complex than it needs to be.  The failure case 
is supposed to be unusual, and the processing time for the awk script 
was expected if there was success, so this isn't a particular waste of 
system resources.

If we knew all of the usage cases for these scripts, we could probably 
do something better, but since some of these scripts have been in 
distribution for a while, I felt it best to avoid changing the 
processing cycle and output as much as possible while still adding a 
report of failures.

Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20070805/79b3e019/attachment.html>


More information about the general mailing list