[ewg] [PATCH] ibstatus - small script change
Jeremy Brown
jeremy.brown at qlogic.com
Tue Feb 12 16:33:21 PST 2008
The ibstatus script, in infiniband-diags, doesn't tolerate a missing
device very well. This small fix makes the output a bit more useful.
Before: $ ibstatus
/usr/bin/ibstatus: line 60: cd: /sys/class/infiniband: No such file or directory
Fatal error: device '8cpu-mdout.8hoursamber8-8hr-2007-09-06-01:52:23': sys
files not found
(/sys/class/infiniband/8cpu-mdout.8hoursamber8-8hr-2007-09-06-01:52:23/ports)
After: $ ibstatus
Fatal error: No devices
Thanks for considering this!
Jeremy
--- infiniband-diags-1.3.5-orig/scripts/ibstatus 2008-02-07 02:35:43.000000000 -0800
+++ infiniband-diags-1.3.5/scripts/ibstatus 2008-02-12 15:50:58.000000000 -0800
@@ -42,7 +42,7 @@
fi
if [ "$2" = "+" ]; then
- ports=`(cd "$infiniband_base/$1/ports"; echo *)`
+ ports=`(cd "$infiniband_base/$1/ports" 2>/dev/null || fatal No devices; echo *)`
else
ports=$2
fi
@@ -57,7 +57,7 @@
fi
if [ -z "$1" ]; then
- cd $infiniband_base
+ cd $infiniband_base 2>/dev/null || fatal No devices
for dev in *; do
ib_status $dev "+";
done
More information about the ewg
mailing list