[ofa-general] [PATCH] Fix ibidsverify.pl to use the correct cache file

Ira Weiny weiny2 at llnl.gov
Fri Apr 3 16:02:49 PDT 2009


Sasha,

I found this bug when I was testing the libibnetdisc stuff.

This applies to the master.

Ira

>From 656ad88a1f3ca6bcd7601b03da1b3822e4091156 Mon Sep 17 00:00:00 2001
From: Ira Weiny <weiny2 at llnl.gov>
Date: Fri, 3 Apr 2009 16:00:46 -0700
Subject: [PATCH] Fix ibidsverify.pl to use the correct cache file

In addition add the -C and -P options for specifying a different HCA and port

Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/scripts/ibidsverify.pl |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/infiniband-diags/scripts/ibidsverify.pl b/infiniband-diags/scripts/ibidsverify.pl
index 0d017ba..06a8903 100755
--- a/infiniband-diags/scripts/ibidsverify.pl
+++ b/infiniband-diags/scripts/ibidsverify.pl
@@ -46,16 +46,22 @@ sub usage_and_exit
 	print "   -h This help message\n";
 	print
 "   -R Recalculate ibnetdiscover information (Default is to reuse ibnetdiscover output)\n";
+	print "   -C <ca_name> use selected Channel Adaptor name for queries\n";
+	print "   -P <ca_port> use selected channel adaptor port for queries\n";
 	exit 2;
 }
 
 my $argv0          = `basename $0`;
 my $regenerate_map = undef;
+my $ca_name            = "";
+my $ca_port            = "";
 
 chomp $argv0;
-if (!getopts("hR")) { usage_and_exit $argv0; }
+if (!getopts("hRC:P:")) { usage_and_exit $argv0; }
 if (defined $Getopt::Std::opt_h) { usage_and_exit $argv0; }
 if (defined $Getopt::Std::opt_R) { $regenerate_map = $Getopt::Std::opt_R; }
+if (defined $Getopt::Std::opt_C) { $ca_name            = $Getopt::Std::opt_C; }
+if (defined $Getopt::Std::opt_P) { $ca_port            = $Getopt::Std::opt_P; }
 
 sub validate_non_zero_lid
 {
@@ -163,13 +169,12 @@ sub insert_portguid
 
 sub main
 {
-	if ($regenerate_map
-		|| !(-f "$IBswcountlimits::cache_dir/ibnetdiscover.topology"))
-	{
-		generate_ibnetdiscover_topology;
-	}
+	my $cache_file = get_cache_file($ca_name, $ca_port);
 
-	open IBNET_TOPO, "<$IBswcountlimits::cache_dir/ibnetdiscover.topology"
+	if ($regenerate_map || !(-f "$cache_file")) {
+		generate_ibnetdiscover_topology($ca_name, $ca_port);
+	}
+	open IBNET_TOPO, "<$cache_file"
 	  or die "Failed to open ibnet topology: $!\n";
 
 	my $nodetype  = "";
-- 
1.5.4.5




More information about the general mailing list