From d7971daed7996eb16d111a7edfb7b6fe395f8680 Mon Sep 17 00:00:00 2001 From: yinle Date: Thu, 13 Jan 2011 10:42:26 +0000 Subject: [PATCH] FSP/BPA redundancy: change the way of finding the fsp/bpa's IP address from checking hosts table to checking itself first. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8641 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 55 +++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 62d5ab21f..3a5d780f1 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2843,33 +2843,56 @@ sub getNodeIPaddress } } - my $hstab = xCAT::Table->new('hosts'); - if ( $hstab ) { - my @myip = (); - foreach ( @$c1 ) - { - my $point= $hstab->getNodeAttribs($_, ['ip']); - my $value = $point->{ip}; - push (@myip, $value); - } - $ips = join ",", @myip; - return $ips; + #my $hstab = xCAT::Table->new('hosts'); + #if ( $hstab ) { + # my @myip = (); + # foreach ( @$c1 ) + # { + # my $point= $hstab->getNodeAttribs($_, ['ip']); + # my $value = $point->{ip}; + # push (@myip, $value); + # } + # $ips = join ",", @myip; + # return $ips; + #} + + #modify the way of finding IP address. + my @myip = (); + my @nonip =(); + foreach ( @$c1 ) + { + my $ifip = isIpaddr($_); + if ($ifip) { + push (@myip, $_); + } else { + push (@nonip, $_); + } } + my $hstab = xCAT::Table->new('hosts'); + if ( $hstab ) { + my $ent = $hstab->getNodesAttribs(\@nonip,['ip']); + foreach ( @nonip) { + push (@myip, $_); + } + } + $ips = join ",", @myip; + return $ips; } } } } - - + + + if ( $nodeip ) { return $nodeip; } else { return undef; } } - - - + + + #------------------------------------------------------------------------------- =head3 thishostisnot