ipv6 fix, replace the Socket library calls with NetworkUtils subroutines
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6067 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
e74645de77
commit
7614a03edb
@ -643,7 +643,7 @@ sub get_server_nodes
|
||||
else
|
||||
{
|
||||
# get ip facing node
|
||||
$serv = xCAT::Utils->getFacingIP($node);
|
||||
$serv = xCAT::Utils->my_ip_facing($node);
|
||||
}
|
||||
chomp $serv;
|
||||
|
||||
|
@ -142,7 +142,7 @@ sub makescript {
|
||||
$value = $et->{'xcatmaster'};
|
||||
} else {
|
||||
my $sitemaster_value = $value;
|
||||
$value=xCAT::Utils->getFacingIP($node);
|
||||
$value=xCAT::Utils->my_ip_facing($node);
|
||||
if ($value eq "0") {
|
||||
$value = $sitemaster_value;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package xCAT_plugin::yaboot;
|
||||
use Data::Dumper;
|
||||
use Sys::Syslog;
|
||||
use xCAT::Scope;
|
||||
use xCAT::NetworkUtils;
|
||||
use File::Path;
|
||||
use Socket;
|
||||
use Getopt::Long;
|
||||
@ -125,7 +126,7 @@ sub setstate {
|
||||
print $pcfg "\tappend=\"".$kern->{kcmdline}."\"\n";
|
||||
}
|
||||
close($pcfg);
|
||||
my $inetn = inet_aton($node);
|
||||
my $inetn = xCAT::NetworkUtils->getipaddr($node);
|
||||
unless ($inetn) {
|
||||
syslog("local1|err","xCAT unable to resolve IP for $node in yaboot plugin");
|
||||
return;
|
||||
@ -134,7 +135,7 @@ sub setstate {
|
||||
print $pcfg "bye\n";
|
||||
close($pcfg);
|
||||
}
|
||||
my $ip = inet_ntoa(inet_aton($node));;
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
unless ($ip) {
|
||||
syslog("local1|err","xCAT unable to resolve IP in yaboot plugin");
|
||||
return;
|
||||
@ -148,8 +149,9 @@ sub setstate {
|
||||
my @macs = split(/\|/,$ment->{mac});
|
||||
foreach (@macs) {
|
||||
if (/!(.*)/) {
|
||||
if (inet_aton($1)) {
|
||||
$ipaddrs{inet_ntoa(inet_aton($1))} = 1;
|
||||
my $ipaddr = xCAT::NetworkUtils->getipaddr($1);
|
||||
if ($ipaddr) {
|
||||
$ipaddrs{$ipaddr} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ use lib "$::XCATROOT/lib/perl";
|
||||
use Sys::Syslog;
|
||||
use xCAT::Table;
|
||||
use xCAT::Utils;
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT_plugin::ipmi;
|
||||
use xCAT_monitoring::monitorctrl;
|
||||
use Socket;
|
||||
@ -182,8 +183,7 @@ while ($temp=<STDIN>) {
|
||||
|
||||
# get the host name if it is unknown
|
||||
if ($node1 =~/<UNKNOWN>/) {
|
||||
my $iaddr = inet_aton($ip1);
|
||||
my ($name) = gethostbyaddr($iaddr, AF_INET);
|
||||
my $name = xCAT::NetworkUtils->gethostname($iaddr);
|
||||
if ($name) {
|
||||
$node1=$name;
|
||||
$host=$name;
|
||||
|
@ -23,6 +23,7 @@ BEGIN
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use strict;
|
||||
use xCAT::Utils;
|
||||
use xCAT::NetworkUtils;
|
||||
use Getopt::Long;
|
||||
use xCAT::MsgUtils;
|
||||
use Socket;
|
||||
@ -826,32 +827,11 @@ sub initDB
|
||||
my $tftpdir = "$::TFTPDIR";
|
||||
my $installdir = "$::INSTALLDIR";
|
||||
my $master;
|
||||
my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($hname);
|
||||
if ($? == 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
|
||||
{
|
||||
$master = xCAT::NetworkUtils->getipaddr($hname);
|
||||
if (!$master) {
|
||||
xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed.");
|
||||
$master = "NORESOLUTION";
|
||||
}
|
||||
}
|
||||
# for policy table
|
||||
# get hostname from the /etc/xcat/cert/server-cert.pem
|
||||
my $MNname;
|
||||
|
Loading…
Reference in New Issue
Block a user