fix for defect 2932537 add check for no ipaddress returned and for an ip address that starts with 127.0.0
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4966 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
75cddb7df3
commit
25ab309d45
@ -810,7 +810,23 @@ sub initDB
|
||||
my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($hname);
|
||||
if ($? == 0)
|
||||
{
|
||||
$master = inet_ntoa($addrs[0]);
|
||||
my $len= scalar(@addrs);
|
||||
if ($len > 0 ) { # we got some ip addresses
|
||||
for (my $i = 0 ; $i < $len ; $i++){
|
||||
my @ipaddr=inet_ntoa($addrs[$i]);
|
||||
if (!grep(/127.0.0/, @ipaddr)) {
|
||||
$master = inet_ntoa($addrs[$i]);
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (!defined($master)) {
|
||||
xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed.");
|
||||
$master = "NORESOLUTION";
|
||||
}
|
||||
} else {
|
||||
xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed.");
|
||||
$master = "NORESOLUTION";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user