defect 3041747: IO::Socket::INET->new has problem to handle the hostname, use the IP to replace. And added the retry for update state
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7116 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
aaa6317e03
commit
b7054d0545
@ -445,10 +445,19 @@ sub updateflag {
|
||||
my $state="booted";
|
||||
|
||||
my $port = "3002";
|
||||
my $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $servnode, PeerPort => $port, );
|
||||
my $servip = `host $servnode | awk '{print \$3}'`;
|
||||
chomp($servip);
|
||||
my $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $servip, PeerPort => $port, Timeout => 0);
|
||||
|
||||
my $try = 10;
|
||||
while (!$remote && $try-- > 0) {
|
||||
sleep 1;
|
||||
$remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $servip, PeerPort => $port, Timeout => 0);
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Cannot connect to host \'$servip\'\n";
|
||||
}
|
||||
unless ($remote) {
|
||||
print "$::sdate xcataixpost: Cannot connect to host \'$servnode\'\n";
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Cannot connect to host \'$servnode\'\n";
|
||||
print "$::sdate xcataixpost: Cannot connect to host \'$servip\'\n";
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Cannot connect to host \'$servip\'\n";
|
||||
return 1;
|
||||
}
|
||||
$remote->autoflush(1);
|
||||
|
Loading…
Reference in New Issue
Block a user