From ebe03d3c51600e7561dfe64865f7bbcf023409f6 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Wed, 20 Apr 2011 09:52:33 +0000 Subject: [PATCH] Removed --hfi for getmacs command git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9357 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/FSPmac.pm | 59 +++++++++----------------------- perl-xCAT/xCAT/PPCmac.pm | 74 +++++++++++++++------------------------- perl-xCAT/xCAT/Usage.pm | 4 +-- 3 files changed, 47 insertions(+), 90 deletions(-) diff --git a/perl-xCAT/xCAT/FSPmac.pm b/perl-xCAT/xCAT/FSPmac.pm index 1bf7f3bed..38822ca56 100644 --- a/perl-xCAT/xCAT/FSPmac.pm +++ b/perl-xCAT/xCAT/FSPmac.pm @@ -108,10 +108,11 @@ sub do_getmacs { } } - if ( exists( $opt->{hfi} )) { - $cmd .=" -t hfi-ent"; + my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] ); + if ( grep /hf/, $client_nethash{$node}{mgtifname} ) { + $cmd .= " -t hfi-ent"; } else { - $cmd .=" -t ent"; + $cmd .= " -t ent"; } ####################################### @@ -578,50 +579,24 @@ sub format_mac { ##################################### # Get adapter mac ##################################### - #$data =~ /^(\S+\s+\S+\s+)(\S+)(\s+.*)$/; - #my $mac = $2; - #my $save = $mac; - ##################################### - # Currenlty HFI drivers don't support - # broadcast, users need to fresh the - # ARP table. Write 3 MAC addresses - # is useless in this case. Comment - # the code until HFI drivers support - # broadcast. - ##################################### -# if ( $data =~ /^hfi-ent\s+/ ) { -# my @macs; -# my $newmac; -# my $newmac0 = cal_mac( $mac ); -# my $newmac1 = cal_mac( $newmac0 ); -# push @macs, $mac; -# push @macs, $newmac0; -# push @macs, $newmac1; -# foreach my $mac_a ( @macs ) { -# if ( !xCAT::Utils->isAIX() ) { -# $mac_a = lc($mac_a); -# $mac_a =~ s/(\w{2})/$1:/g; -# $mac_a =~ s/:$//; -# $newmac = $newmac.",".$mac_a; -# } else { -# $newmac = $newmac.",".$mac_a; -# } -# $newmac =~ s/^,//; -# } -# $data =~ s/$save/$newmac/; -# } else { + my @newmacs; + my @macs = split /\|/, $mac; + + foreach my $mac_a ( @macs ) { if ( !xCAT::Utils->isAIX() ) { ################################# # Delineate MAC with colons ################################# - $mac = lc($mac); - $mac =~ s/(\w{2})/$1:/g; - $mac =~ s/:$//; - #$data =~ s/$save/$mac/; + $mac_a = lc($mac_a); + $mac_a =~ s/(\w{2})/$1:/g; + $mac_a =~ s/:$//; + push @newmacs, $mac_a; } -# } - #return( "$data\n" ); - return( "$mac" ); + } + + my $newmac = join("|",@newmacs); + + return( "$newmac" ); } diff --git a/perl-xCAT/xCAT/PPCmac.pm b/perl-xCAT/xCAT/PPCmac.pm index d535f9185..9f103bb32 100644 --- a/perl-xCAT/xCAT/PPCmac.pm +++ b/perl-xCAT/xCAT/PPCmac.pm @@ -44,7 +44,7 @@ sub parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt,qw(h|help V|Verbose v|version C=s G=s S=s D d f hfi o F=s arp))) { + if ( !GetOptions( \%opt,qw(h|help V|Verbose v|version C=s G=s S=s D d f o F=s arp))) { return( usage() ); } #################################### @@ -88,7 +88,7 @@ sub parse_args { if ( exists($opt{S}) ) { push @network, $_; } else { - $server = xCAT::Utils->getSNformattedhash( $node, "xcat", "MN", "primary" ); + $server = xCAT::Utils->getSNformattedhash( $node, "xcat", "node", "primary" ); foreach my $key ( keys %$server ) { my $valid_ip = xCAT::Utils->validate_ip( $key ); if ( $valid_ip ) { @@ -206,18 +206,14 @@ sub parse_args { #################################### # Check -F options's format #################################### - if ( exists($opt{F}) ) { - my @filters = split /,/,$opt{F}; - foreach ( @filters ) { - my @value = split /=/,$_; - if ( !@value[1] ) { - return( usage("Option '-F' contains wrong filter format") ); - } + if ( exists($opt{F}) ) { + my @filters = split /,/,$opt{F}; + foreach ( @filters ) { + my @value = split /=/,$_; + if ( !@value[1] ) { + return( usage("Option '-F' contains wrong filter format") ); } } - - if ( exists($opt{hfi}) && !exists($opt{D}) ) { - return( usage("Option 'hfi' must work with '-D'") ); } #################################### @@ -321,10 +317,11 @@ sub do_getmacs { } } - if ( exists( $opt->{hfi} )) { - $cmd .=" -t hfi-ent"; + my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] ); + if ( grep /hf/, $client_nethash{$node}{mgtifname} ) { + $cmd.= " -t hfi-ent"; } else { - $cmd .=" -t ent"; + $cmd.= " -t ent"; } ####################################### @@ -744,46 +741,31 @@ sub cal_mac { ########################################################################## sub format_mac { - my $data = shift; + my $mac = shift; + #my $data = shift; ##################################### # Get adapter mac ##################################### - $data =~ /^(\S+\s+\S+\s+)(\S+)(\s+.*)$/; - my $mac = $2; - my $save = $mac; - if ( $data =~ /^hfi-ent\s+/ ) { - my @macs; - my $newmac; - my $newmac0 = cal_mac( $mac ); - my $newmac1 = cal_mac( $newmac0 ); - push @macs, $mac; - push @macs, $newmac0; - push @macs, $newmac1; - foreach my $mac_a ( @macs ) { - if ( !xCAT::Utils->isAIX() ) { - $mac_a = lc($mac_a); - $mac_a =~ s/(\w{2})/$1:/g; - $mac_a =~ s/:$//; - $newmac = $newmac.",".$mac_a; - } else { - $newmac = $newmac.",".$mac_a; - } - $newmac =~ s/^,//; - } - $data =~ s/$save/$newmac/; - } else { + my @newmacs; + my @macs = split /\|/, $mac; + + foreach my $mac_a ( @macs ) { if ( !xCAT::Utils->isAIX() ) { ################################# - # Delineate MAC with colons + # Delineate MAC with colons ################################# - $mac = lc($mac); - $mac =~ s/(\w{2})/$1:/g; - $mac =~ s/:$//; - $data =~ s/$save/$mac/; + $mac_a = lc($mac_a); + $mac_a =~ s/(\w{2})/$1:/g; + $mac_a =~ s/:$//; + push @newmacs, $mac_a; } } - return( "$data\n" ); + + my $newmac = join("|",@newmacs); + + return( "$newmac" ); + } diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 47b06062f..0d4e7c9df 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -17,7 +17,7 @@ use xCAT::Utils; my %usage = ( "rnetboot" => -"Usage: rnetboot [-s net|hd] [-F] [-f] [--hfi] [-V|--verbose] [-m table.colum==expectedstatus] [-m table.colum==expectedstatus...] [-r ] [-t ] +"Usage: rnetboot [-s net|hd] [-F] [-f] [-V|--verbose] [-m table.colum==expectedstatus] [-m table.colum==expectedstatus...] [-r ] [-t ] rnetboot [-h|--help|-v|--version]", "rpower" => "Usage: rpower [--nodeps] [on|onstandby|off|suspend|reset|stat|state|boot] [-V|--verbose] [-m table.colum==expectedstatus][-m table.colum==expectedstatus...] [-r ] [-t ] @@ -139,7 +139,7 @@ my %usage = ( getmacs [-h|--help|-v|--version] PPC specific: getmacs [-F filter] - getmacs [-V| --verbose] [-f] [-d] [--hfi] [--arp] | [-D [-S server] [-G gateway] [-C client]] + getmacs [-V| --verbose] [-f] [-d] [--arp] | [-D [-S server] [-G gateway] [-C client]] blade specific: getmacs [-V| --verbose] [-d] [--arp] ",