diff --git a/perl-xCAT/xCAT/PPCdb.pm b/perl-xCAT/xCAT/PPCdb.pm index 6a6131426..9b16f02d4 100644 --- a/perl-xCAT/xCAT/PPCdb.pm +++ b/perl-xCAT/xCAT/PPCdb.pm @@ -579,10 +579,10 @@ sub rm_ppc { sub add_systemX { my $hwtype = shift; + my $name = shift; my $data = shift; my @tabs = qw(mpa mp nodehm nodelist); my %db = (); - my $name = @$data[4]; ################################### # Open database needed diff --git a/xCAT-client/pods/man1/lsslp.1.pod b/xCAT-client/pods/man1/lsslp.1.pod index 6d824815c..3db24ad12 100644 --- a/xCAT-client/pods/man1/lsslp.1.pod +++ b/xCAT-client/pods/man1/lsslp.1.pod @@ -9,12 +9,12 @@ I I -I +I =head1 DESCRIPTION -The lsslp command discovers selected service types using the -s flag. All service types are returned if the -s flag is not specified. If a specific IP address is not specified using the -i flag, the request is sent out all available network adapters. The optional -r, -x, and -z flags format the output. +The lsslp command discovers selected service types using the -s flag. All service types are returned if the -s flag is not specified. If a specific IP address is not specified using the -i flag, the request is sent out all available network adapters. The optional -r, -x, -z and --vpdtable flags format the output. NOTE: SLP broadcast requests will propagate only within the subnet of the network adapter broadcast IPs specified by the -i flag. @@ -40,14 +40,32 @@ B<-h> Display usage message. B<-m> Multicast mode (defaults to broadcast). +B<--makedhcp> Issue xCAT command makedhcp internally. + +B<-M> Matching mode, match the pre-defined node names from vpd table or switch table. + Default is using factory name if no -M specified. + B<-n> Only display and write the newly discovered hardwares. B<-r> Display Raw SLP response. +B<--resetnet> Login to hardwares and reset the network interfaces. This option is only valid + for the nodes with different attributes: ip and otherinterfaces in hosts table. + B<-s> Service type interested in discovering. B<-t> Number or service-request attempts. +B<--updatehosts> Display current IP address or write the ip address into xCAT DB. Please be + aware that otherinterfaces column in hosts table saved the current ip address, + ip column stores the new ip address that user defined. With this option, lsslp + will write the current ip to ip column also, which means the ip user wants is + the same as current ip address running on hardwares. This is to avoid useless + network resetting that if ip and otherinterfaces are the same, lsslp will skip + the network resetting for that node. + +B<--vpdtable> Output the SLP response in vpdtable formatting. Easy for writting data to vpd table. + B<-v> Command Version. B<-V> Verbose output. @@ -98,13 +116,13 @@ Output is similar to: mm,all - 0 + 00:14:5E:E0:CB:1E blade - 86772XX - mm01 - mm01 + 029310C + Server-029310C-SN100485A-A mm - 78AG034 + 9.114.47.229 + 100485A @@ -114,35 +132,85 @@ Output is similar to: Output is similar to: - mm01: - objtype=node - nodetype=mm - model=86772XX - serial=78AG034 - groups=mm,all - mgt=blade - mpa=mm01 - id=0 - - hmc01: - objtype=node - nodetype=hmc - model=7310CR3 - serial=KPHHK24 - groups=hmc,all - mgt=hmc - mpa= - id= - - fsp01: + mm01: objtype=node nodetype=fsp - model=9110-51A - serial=1075EEF + mtm=8233-E8B + serial=1000ECP + side=A + otherinterfaces=50.0.0.5 groups=fsp,all - mgt=hmc - mpa= - id= + mgt=fsp + id=0 + mac=00:14:5E:F0:5C:FD + ip=50.0.0.5 + + bpa01: + objtype=node + nodetype=bpa + mtm=9A01-100 + serial=0P1N746 + side=A + otherinterfaces=50.0.0.1 + groups=bpa,all + mgt=bpa + id=0 + mac=00:1A:64:54:8C:A5 + ip=50.0.0.1 + + +5. To list all discovered service types in stanza format and display the IP address, enter: + + lsslp -w --updatehosts + +Output is similar to: + + mm01: + objtype=node + nodetype=fsp + mtm=8233-E8B + serial=1000ECP + side=A + otherinterfaces=50.0.0.5 + groups=fsp,all + mgt=fsp + id=0 + mac=00:14:5E:F0:5C:FD + ip=50.0.0.5 + + bpa01: + objtype=node + nodetype=bpa + mtm=9A01-100 + serial=0P1N746 + side=A + otherinterfaces=50.0.0.1 + groups=bpa,all + mgt=bpa + id=0 + mac=00:1A:64:54:8C:A5 + ip=50.0.0.1 + + +6. To list all the FSPs and reset their network interfaces to get new IP from dhcp server, enter: + + lsslp -s FSP --resetnet + +Output is similar to: + + Start to reset network.. + + Reset network failed nodes: + + Reset network succeed nodes: + Server-8233-E8B-SN1000ECP-A,Server-9119-FHA-SN0275995-B,Server-9119-FHA-SN0275995-A, + + Reset network finished. + + device type-model serial-number side ip-addresses hostname + FSP 8233-E8B 1000ECP A 192.168.200.19 50.0.0.5 Server-8233-E8B-SN1000ECP-A(50.0.0.5) + FSP 9119-FHA 0275995 A 192.168.200.6 50.0.0.3 Server-9119-FHA-SN0275995-A(50.0.0.3) + FSP 9119-FHA 0275995 B 192.168.200.2 50.0.0.4 Server-9119-FHA-SN0275995-B(50.0.0.4) =head1 FILES diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index cd2b1cc5e..92f418dab 100644 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -96,7 +96,7 @@ my %mgt = ( lc(TYPE_RSA) => "blade" ); -my @attribs = qw(nodetype serial serial side otherinterfaces groups mgt id parent mac); +my @attribs = qw(nodetype mtm serial side otherinterfaces groups mgt id parent mac); my $verbose = 0; my %ip_addr = (); my %slp_result = (); @@ -1185,7 +1185,7 @@ sub gethost_from_url { } if ( !$host ) { - $host = getFactoryHostname($type,$mtm,$sn,$side,$rsp); + $host = getFactoryHostname($type,$mtm,$sn,$side,$ip,$rsp); ####################################### # Convert hostname to short-hostname ####################################### @@ -1294,6 +1294,7 @@ sub getFactoryHostname my $mtm = shift; my $sn = shift; my $side = shift; + my $ip = shift; my $rsp = shift; my $host = undef; @@ -1312,6 +1313,14 @@ sub getFactoryHostname { $host = "Server-$mtm-SN$sn-$side"; } + + if ( $ip ) { + my $hname = gethostbyaddr( inet_aton($ip), AF_INET ); + if ( $hname ) { + $host = $hname; + } + } + return $host; } @@ -1634,6 +1643,7 @@ sub parse_responses { my $type = @$data[0]; my $mtm = @$data[1]; my $sn = @$data[2]; + my $side = @$data[3]; my $frame; my ($name, $ip); @@ -1645,6 +1655,15 @@ sub parse_responses { $ip = @$data[4]; } + ############################################################ + # -n flag to skip the existing node + ############################################################ + if ( exists( $opt{n} ) ) { + if ( exists $vpd_table_hash{$mtm . '*' . $sn . '-' . $side} ) { + next; + } + } + if ( $type =~ /^FSP$/ ) { ############################################################ # For HE machine, there are 2 FSPs, but only one FSP have the @@ -1701,13 +1720,25 @@ sub parse_responses { my $type = @$data[0]; my $mtm = @$data[1]; my $serial = @$data[2]; - my $bpc_model = @$data[5]; - my $bpc_serial = @$data[6]; - my $frame_number = @$data[7]; - my $cage_number = @$data[8]; - my $side = @$data[3]; - $host = match_switchtable($ip, $mac, $type, $bpc_model, $bpc_serial, $frame_number, $cage_number, $side, $mtm, $serial); + if ( $type =~ /^BPA$/ or $type =~ /^FSP$/ ) { + my $bpc_model = @$data[5]; + my $bpc_serial = @$data[6]; + my $frame_number = @$data[7]; + my $cage_number = @$data[8]; + my $side = @$data[3]; + + $host = match_switchtable($ip, $mac, $type, $bpc_model, $bpc_serial, $frame_number, $cage_number, $side, $mtm, $serial); + } else { + my $bpc_model = undef; + my $bpc_serial = undef; + my $frame_number = undef; + my $cage_number = undef; + my $side = @$data[3]; + + $host = match_switchtable($ip, $mac, $type, $bpc_model, $bpc_serial, $frame_number, $cage_number, $side, $mtm, $serial); + } + if ( $host ) { $h = "$host($ip)"; } @@ -1792,7 +1823,7 @@ sub xCATdB { xCAT::PPCdb::add_ppc( "fsp", [$values], 0, 1 ); } elsif ( $type =~ /^(RSA|MM)$/ ) { - xCAT::PPCdb::add_systemX( $type, $data ); + xCAT::PPCdb::add_systemX( $type, $name, $data ); } } } @@ -2619,7 +2650,7 @@ sub disti_multi_node } } - if ( $nodetype->{'nodetype'} eq 'bpa' ) { + if ( $nodetype->{'nodetype'} eq 'bpa' or $nodetype->{'nodetype'} eq 'mm' ) { ########################################### # If there is a hub to connect several BPAs # with the same switch port, check this