[ofa-general] [PATCH] infiniband-diags/dump_lfts.sh: fix switch DR Path parser

Sasha Khapyorsky sashak at voltaire.com
Thu Jan 3 00:30:39 PST 2008


It is highly possible that ibnetdiscover finds the same switches at
different paths. In this case the current version of the script will
dump LFTs multiple times for the same switches. This patch fixes this
bug - all discovered paths are sorted and unified by switch GUIDs.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 infiniband-diags/scripts/dump_lfts.sh |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/infiniband-diags/scripts/dump_lfts.sh b/infiniband-diags/scripts/dump_lfts.sh
index 81984af..ebca705 100755
--- a/infiniband-diags/scripts/dump_lfts.sh
+++ b/infiniband-diags/scripts/dump_lfts.sh
@@ -23,8 +23,9 @@ done
 dump_by_dr_path ()
 {
 for sw_dr in `ibnetdiscover $ca_info -v \
-	| sed -ne '/^DR path .* switch /s/^DR path \([,|0-9]\+\) ->.*$/\1/p' \
-	| sort -u` ; do
+	| sed -ne '/^DR path .* switch /s/^DR path \([,|0-9]\+\) ->.*{\([0-9|a-f]\+\)}.*$/\2 \1/p' \
+	| sort -u \
+	| awk 'BEGIN {guid=0;} {if ($1 != guid) { guid=$1; print $2; }}'` ; do
 	ibroute $ca_info -D ${sw_dr}
 done
 }
-- 
1.5.3.4.206.g58ba4




More information about the general mailing list