From 1ee230494fc48a74d5a10073bdd8e90efb8f6fb6 Mon Sep 17 00:00:00 2001 From: jjhua Date: Sat, 2 Apr 2011 07:29:50 +0000 Subject: [PATCH] fix the defect that it failed to get the IP address of the BPA or FSP nodename defined git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9224 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 1b8d4cb35..b759672f3 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2899,18 +2899,33 @@ sub getNodeIPaddress push (@nonip, $_); } } - if (scalar(@nonip)){ - my $hstab = xCAT::Table->new('hosts'); - if ( $hstab ) { - my $ent = $hstab->getNodesAttribs(\@nonip,['ip']); - if ($ent){ - foreach (@nonip) { - my $i = $ent->{$_}->[0]->{ip}; - push (@myip, $i); - } + #if (scalar(@nonip)){ + # my $hstab = xCAT::Table->new('hosts'); + # if ( $hstab ) { + # my $ent = $hstab->getNodesAttribs(\@nonip,['ip']); + # if ($ent){ + # foreach (@nonip) { + # my $i = $ent->{$_}->[0]->{ip}; + # push (@myip, $i); + # } + # } + # } + #} + foreach my $t (@nonip) { + $nodeip = xCAT::NetworkUtils->getipaddr($t); + if (!$nodeip) { + my $hoststab = xCAT::Table->new( 'hosts'); + my $ent = $hoststab->getNodeAttribs( $t, ['ip'] ); + if ( $ent->{'ip'} ) { + $nodeip = $ent->{'ip'}; } } - } + if($nodeip) { + push (@myip, $nodeip); + } + } + + $ips = join ",", @myip; return $ips; }