From ec81ac9aa082e9f67f2fdcdd9f488d9f5033d3f1 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 4 Nov 2011 18:04:27 +0000 Subject: [PATCH] fix performance issue with getNodeIPaddress, the problem is in DBobjUtils->getchildren, but this routine never should have called DBobjUtils->getchildren. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.6@10972 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 69a04e01d..2dddc2d6c 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2852,6 +2852,15 @@ sub nodeonmynet =head3 getNodeIPaddress + Arguments: + Node name only one at a time + Returns: ip address(s) + Globals: + none + Error: + none + Example: my $c1 = xCAT::Utils::getNodeIPaddress($nodetocheck); + =cut #------------------------------------------------------------------------------- @@ -2882,8 +2891,25 @@ sub getNodeIPaddress my $type = xCAT::DBobjUtils->getnodetype($nodetocheck); if ($type) { if ($type eq "frame" or $type eq "cec") { - $c1 = xCAT::DBobjUtils->getchildren($nodetocheck); - + # Read the ppc table for any entry that + # has parent=nodename and nodetype fsp or bpa + my $ppctab = xCAT::Table->new( 'ppc' ); + my @ps = $ppctab->getAllNodeAttribs(['node','parent','nodetype']); + my $parent; + my $node; + my $type; + #search for addresses + for my $entry ( @ps ) { + $parent = $entry->{parent}; + $node = $entry->{node}; + $type = $entry->{nodetype}; + if (defined($parent) and $parent eq $nodetocheck ) { + if ( defined($type) and $type eq 'fsp' or $type eq 'bpa'){ + push @$c1,$node; + } + } + } + #if $port exists, only for mkhwconn ... CEC/Frame if ( defined($port) ) { my @fsp_bpa = @$c1;