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/trunk@10971 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2011-11-04 17:55:35 +00:00
parent 0a194937d9
commit a0ab156078

View File

@ -2754,9 +2754,11 @@ sub nodeonmynet
} else {
my @v6routes = split /\n/,`ip -6 route`;
foreach (@v6routes) {
if (/via/ or /^unreachable/ or /^fe80::\/64/) { #only count local ones, remote ones can be caught in next loop
#also, link-local would be a pitfall, since more context than address is
#needed to determine locality
if (/via/ or /^unreachable/ or /^fe80::\/64/) {
#only count local ones, remote ones can be caught in next loop
#also, link-local would be a pitfall,
#since more context than address is
#needed to determine locality
next;
}
s/ .*//; #remove all after the space
@ -2840,6 +2842,14 @@ 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
@ -2871,8 +2881,24 @@ 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;