[ofa-general] Re: [PATCH] Fix bug with "-S" option which prevented some formated GUIDs from being found.

Ira Weiny weiny2 at llnl.gov
Fri Feb 29 10:23:03 PST 2008


Your right...  This does not work.  On my test cluster it seemed to work because there is only 1 switch.  :-(

I will redo the fix,
Ira


On Fri, 29 Feb 2008 13:01:23 +0000
Sasha Khapyorsky <sashak at voltaire.com> wrote:

> Hi Ira,
> 
> On 15:10 Thu 28 Feb     , Ira Weiny wrote:
> > We have found that some tools and log files print guids without leading 0's
> > (eg 0x8f10400411f56 vs 0x0008f10400411f56)
> > 
> > The perl script "-S" option were failing without leading 0's.  This patch
> > formats the guids properly before performing lookups.
> > 
> > Ira
> > 
> > From f1ab294d12569f81913c3c169ecefb003c11f714 Mon Sep 17 00:00:00 2001
> > From: Ira K. Weiny <weiny2 at llnl.gov>
> > Date: Thu, 28 Feb 2008 15:03:23 -0800
> > Subject: [PATCH] Fix bug with "-S" option which prevented some formated GUIDs from being found.
> > 
> > 
> > Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
> > ---
> >  infiniband-diags/scripts/IBswcountlimits.pm |   17 ++++++++++++++++-
> >  infiniband-diags/scripts/iblinkinfo.pl      |    8 +++++---
> >  infiniband-diags/scripts/ibqueryerrors.pl   |    4 +++-
> >  3 files changed, 24 insertions(+), 5 deletions(-)
> > 
> > diff --git a/infiniband-diags/scripts/IBswcountlimits.pm b/infiniband-diags/scripts/IBswcountlimits.pm
> > index bddc421..3fd1efa 100755
> > --- a/infiniband-diags/scripts/IBswcountlimits.pm
> > +++ b/infiniband-diags/scripts/IBswcountlimits.pm
> > @@ -431,6 +431,21 @@ sub get_num_ports
> >  }
> >  
> >  # =========================================================================
> > +# format_switch_guid(guid)
> > +# The diags store the switch guids as strings.  This converts the guid supplied
> > +# to the correct string format.
> > +# eg: 0x0008f10400411f56 and 0x8f10400411f56 Should be equal but the strings
> > +# are not.
> > +#
> > +sub format_switch_guid
> > +{
> > +	my $guid     = $_[0];
> > +	my $guid_str = "";
> > +	sprintf($guid_str, "0x%0X", $guid);
> > +	return ($guid_str);
> > +}
> 
> It doesn't work for me (I used this with perl -d). This sub returns
> nothing, shouldn't this be: $guid_str = sprintf("0x%0X", $guid) ?
> Also $guid is string here.
> 
> Sasha
> 
> > +
> > +# =========================================================================
> >  # convert_dr_to_guid(direct_route)
> >  #
> >  sub convert_dr_to_guid
> > @@ -442,7 +457,7 @@ sub convert_dr_to_guid
> >  	foreach my $line (@lines) {
> >  		if ($line =~ /^PortGuid:\.+(.*)/) { $guid = $1; }
> >  	}
> > -	return $guid;
> > +	return format_switch_guid($guid);
> >  }
> >  
> >  # =========================================================================
> > diff --git a/infiniband-diags/scripts/iblinkinfo.pl b/infiniband-diags/scripts/iblinkinfo.pl
> > index 195c8cf..93152d5 100755
> > --- a/infiniband-diags/scripts/iblinkinfo.pl
> > +++ b/infiniband-diags/scripts/iblinkinfo.pl
> > @@ -80,9 +80,11 @@ chomp $argv0;
> >  
> >  if (!getopts("hcpldRS:D:C:P:g")) { usage_and_exit $argv0; }
> >  if (defined $Getopt::Std::opt_h) { usage_and_exit $argv0; }
> > -if (defined $Getopt::Std::opt_D) { $direct_route       = $Getopt::Std::opt_D; }
> > -if (defined $Getopt::Std::opt_R) { $regenerate_map     = $Getopt::Std::opt_R; }
> > -if (defined $Getopt::Std::opt_S) { $single_switch      = $Getopt::Std::opt_S; }
> > +if (defined $Getopt::Std::opt_D) { $direct_route   = $Getopt::Std::opt_D; }
> > +if (defined $Getopt::Std::opt_R) { $regenerate_map = $Getopt::Std::opt_R; }
> > +if (defined $Getopt::Std::opt_S) {
> > +	$single_switch = format_switch_guid($Getopt::Std::opt_S);
> > +}
> >  if (defined $Getopt::Std::opt_d) { $only_down_links    = $Getopt::Std::opt_d; }
> >  if (defined $Getopt::Std::opt_l) { $line_mode          = $Getopt::Std::opt_l; }
> >  if (defined $Getopt::Std::opt_p) { $print_add_switch   = $Getopt::Std::opt_p; }
> > diff --git a/infiniband-diags/scripts/ibqueryerrors.pl b/infiniband-diags/scripts/ibqueryerrors.pl
> > index ef61e9b..249fba3 100755
> > --- a/infiniband-diags/scripts/ibqueryerrors.pl
> > +++ b/infiniband-diags/scripts/ibqueryerrors.pl
> > @@ -171,7 +171,9 @@ if (defined $Getopt::Std::opt_c) {
> >  if (defined $Getopt::Std::opt_r) { $report_port_info = $Getopt::Std::opt_r; }
> >  if (defined $Getopt::Std::opt_R) { $regenerate_map   = $Getopt::Std::opt_R; }
> >  if (defined $Getopt::Std::opt_D) { $direct_route     = $Getopt::Std::opt_D; }
> > -if (defined $Getopt::Std::opt_S) { $single_switch    = $Getopt::Std::opt_S; }
> > +if (defined $Getopt::Std::opt_S) {
> > +	$single_switch = format_switch_guid($Getopt::Std::opt_S);
> > +}
> >  if (defined $Getopt::Std::opt_d) {
> >  	$include_data_counters = $Getopt::Std::opt_d;
> >  }
> > -- 
> > 1.5.1



More information about the general mailing list