diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 027bcf0a6..b4e600ba1 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -2150,7 +2150,7 @@ sub getchildren $::RUNCMD_RC = 1; return undef; } - my @ps = $ppctab->getAllNodeAttribs(['node','parent','nodetype']); + my @ps = $ppctab->getAllNodeAttribs(['node','parent','nodetype','hcp']); foreach my $entry ( @ps ) { my $p = $entry->{parent}; my $c = $entry->{node}; @@ -2161,13 +2161,19 @@ sub getchildren # build hash of ppc.parent -> ppc.node push @{$PPCHASH{$p}}, $c; } + elsif ($t eq 'blade') { + push @{$PPCHASH{$c}}, $entry->{hcp}; + } } else { # go look in the nodetype table to find nodetype - my $type = getnodetype($c); + my $type = getnodetype($c, "ppc"); if ( $type eq 'fsp' or $type eq 'bpa') { # build hash of ppc.parent -> ppc.node push @{$PPCHASH{$p}}, $c; } + elsif ($type eq "blade") { + push @{$PPCHASH{$c}}, $entry->{hcp}; + } } } # not $p and $c } diff --git a/perl-xCAT/xCAT/FSPUtils.pm b/perl-xCAT/xCAT/FSPUtils.pm index 8236c826b..5f4ef08bf 100644 --- a/perl-xCAT/xCAT/FSPUtils.pm +++ b/perl-xCAT/xCAT/FSPUtils.pm @@ -67,7 +67,7 @@ sub getHcpAttribs } } - my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype']); + my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype','hcp']); for my $entry ( @ps ) { my $tmp_parent = $entry->{parent}; my $tmp_node = $entry->{node}; @@ -76,6 +76,9 @@ sub getHcpAttribs push @{$ppchash{$tmp_parent}{children}}, $tmp_node; #push @{$ppchash{$tmp_parent}}, $tmp_node; } + if (defined($tmp_node) && defiend($tmp_type) && ($tmp_type eq "blade") && defined($entry->{hcp})) { + push @{$ppchash{$tmp_node}{children}}, $entry->{hcp}; + } #if(exists($ppchash{$tmp_node})) { # if( defined($tmp_type) ) { @@ -173,6 +176,8 @@ sub getIPaddress #the $nodetocheck is its' hcp. So set $nodetocheck to $parent variable. #And then get the FSPs IPs for the CEC. $parent = $nodetocheck; + } elsif ($type eq "blade") { + return $ppc->{$nodetocheck}->{children}->[0]; } else { return undef; } diff --git a/perl-xCAT/xCAT/PPCconn.pm b/perl-xCAT/xCAT/PPCconn.pm index 143f05fcd..6e83ccd8a 100644 --- a/perl-xCAT/xCAT/PPCconn.pm +++ b/perl-xCAT/xCAT/PPCconn.pm @@ -99,7 +99,7 @@ sub mkhwconn_parse_args #my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]); my $node_parent_hash = $ppctab->getNodeAttribs( $node,[qw(parent)]); #$nodetype = $nodetype_hash->{nodetype}; - $nodetype = xCAT::DBobjUtils->getnodetype($node); + $nodetype = xCAT::DBobjUtils->getnodetype($node,"ppc"); $node_parent = $node_parent_hash->{parent}; if ( !$nodetype ) { @@ -107,7 +107,7 @@ sub mkhwconn_parse_args next; } else { - unless ( $nodetype =~ /^(fsp|bpa|frame|cec|hmc)$/) + unless ( $nodetype =~ /^(blade|fsp|bpa|frame|cec|hmc)$/) { return ( usage("Node type is incorrect. \n")); } @@ -486,8 +486,9 @@ sub mkhwconn # Get IP address ############################ my $cnode; - my $ntype = xCAT::DBobjUtils::getnodetype($node_name); - if ($ntype =~ /^(cec|frame)$/) + #my $ntype = xCAT::DBobjUtils::getnodetype($node_name); + my $ntype = $$d[4]; + if ($ntype =~ /^(cec|frame|blade)$/) { $cnode = xCAT::DBobjUtils::getchildren($node_name, $opt->{port}); } else { @@ -518,12 +519,17 @@ sub mkhwconn next; } - my ( undef,undef,$mtms,undef,$type) = @$d; + my ( undef,undef,$mtms,undef,$type,$bpa) = @$d; my ($user, $passwd); if ( exists $opt->{P}) { ($user, $passwd) = ('HMC', $opt->{P}); } + elsif ($type eq "blade") { + $user = "USERID"; + ($user, $passwd) = xCAT::PPCdb::credentials( $bpa, $type, $user); + $type = "cec"; + } else { ($user, $passwd) = xCAT::PPCdb::credentials( $node_name, $type,'HMC'); @@ -707,7 +713,7 @@ sub rmhwconn my $d = $node_hash->{$node_name}; my ( undef,undef,undef,undef,$type) = @$d; - + if ($type eq "blade") {$type = "cec";} ############################ # Get IP address ############################ @@ -724,10 +730,19 @@ sub rmhwconn my @ips; foreach my $entry ( @$nodes_found ) { - if ( $entry =~ /$mtm\*$serial/) { - $entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/; - push @ips, $1; + if ($entry =~ /type_model_serial_num=([^,]*),/) { + my $match_mtm1 = $1; + my $match_mtm2 = $match_mtm1; + $match_mtm2 =~ s/\-//; + if ($match_mtm1 =~ /$mtm\*$serial/ || $match_mtm2 =~ /$mtm\*$serial/) { + $entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/; + push @ips, $1; + } } + #if ( $entry =~ /$mtm\*$serial/) { + # $entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/; + # push @ips, $1; + #} } if (!@ips) {