[ofa-general] [PATCH] infiniband-diags/scripts/ib[linkinfo][queryerrors].pl: report switch not found

Ira Weiny weiny2 at llnl.gov
Mon Mar 3 10:59:23 PST 2008


>From 2580633c3842aac4257c6b6a330444ff7fe4a6bf Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Mon, 3 Mar 2008 10:44:56 -0800
Subject: [PATCH] infiniband-diags/scripts/ib[linkinfo][queryerrors].pl: report switch not found


Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/scripts/iblinkinfo.pl    |    6 ++++++
 infiniband-diags/scripts/ibqueryerrors.pl |   10 +++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/infiniband-diags/scripts/iblinkinfo.pl b/infiniband-diags/scripts/iblinkinfo.pl
index b2c90a1..0d3b3ea 100755
--- a/infiniband-diags/scripts/iblinkinfo.pl
+++ b/infiniband-diags/scripts/iblinkinfo.pl
@@ -76,6 +76,7 @@ my $only_down_links    = undef;
 my $ca_name            = "";
 my $ca_port            = "";
 my $print_port_guids   = undef;
+my $switch_found       = "no";
 chomp $argv0;
 
 if (!getopts("hcpldRS:D:C:P:g")) { usage_and_exit $argv0; }
@@ -110,6 +111,8 @@ sub main
 	foreach my $switch (sort (keys(%IBswcountlimits::link_ends))) {
 		if ($single_switch && $switch ne $single_switch) {
 			next;
+		} else {
+			$switch_found = "yes";
 		}
 		my $switch_prompt = "no";
 		my $num_ports = get_num_ports($switch, $ca_name, $ca_port);
@@ -304,6 +307,9 @@ sub main
 			foreach my $line (@output_lines) { print $line; }
 		}
 	}
+	if ($single_switch && $switch_found ne "yes") {
+		printf("Switch \"%s\" not found.\n", $single_switch);
+	}
 }
 main;
 
diff --git a/infiniband-diags/scripts/ibqueryerrors.pl b/infiniband-diags/scripts/ibqueryerrors.pl
index 200a40c..e4e24cb 100755
--- a/infiniband-diags/scripts/ibqueryerrors.pl
+++ b/infiniband-diags/scripts/ibqueryerrors.pl
@@ -44,6 +44,7 @@ my $report_port_info      = undef;
 my $single_switch         = undef;
 my $include_data_counters = undef;
 my $cache_file            = "";
+my $switch_found          = "no";
 
 # =========================================================================
 #
@@ -200,7 +201,11 @@ sub main
 		}
 	}
 	foreach my $sw_addr (keys %switches) {
-		if ($single_switch && $sw_addr ne "$single_switch") { next; }
+		if ($single_switch && $sw_addr ne "$single_switch") {
+			next;
+		} else {
+			$switch_found = "yes";
+		}
 
 		my $switch_prompt = "no";
 		foreach my $sw_port (1 .. $switches{$sw_addr}) {
@@ -214,6 +219,9 @@ sub main
 			report_counts($sw_addr, $sw_port);
 		}
 	}
+	if ($single_switch && $switch_found ne "yes") {
+		printf("Switch \"%s\" not found.\n", $single_switch);
+	}
 }
 main;
 
-- 
1.5.1



More information about the general mailing list