Add connect retries configurable through site.ppcretry
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1255 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
ddf5ea8eac
commit
0d7a9ceb23
@ -7,7 +7,7 @@ use xCAT::Utils;
|
||||
use xCAT::Usage;
|
||||
use POSIX "WNOHANG";
|
||||
use Storable qw(freeze thaw);
|
||||
use Time::HiRes qw(gettimeofday);
|
||||
use Time::HiRes qw(gettimeofday sleep);
|
||||
use IO::Select;
|
||||
use Socket;
|
||||
use xCAT::PPCcli;
|
||||
@ -82,29 +82,30 @@ sub send_msg {
|
||||
sub process_command {
|
||||
|
||||
my $request = shift;
|
||||
my $maxp = 64;
|
||||
my $maxssh = 10;
|
||||
my %nodes = ();
|
||||
my $callback = $request->{callback};
|
||||
my $sitetab = xCAT::Table->new( 'site' );
|
||||
my @site = qw(ppcmaxp ppctimeout maxssh ppcretry fsptimeout);
|
||||
my $start;
|
||||
my $timeout;
|
||||
|
||||
#######################################
|
||||
# Get max processes to fork
|
||||
# Default site table attributes
|
||||
#######################################
|
||||
$request->{ppcmaxp} = 64;
|
||||
$request->{ppctimeout} = 0;
|
||||
$request->{fsptimeout} = 0;
|
||||
$request->{ppcretry} = 3;
|
||||
$request->{maxssh} = 10;
|
||||
|
||||
#######################################
|
||||
# Get site table attributes
|
||||
#######################################
|
||||
if ( defined( $sitetab )) {
|
||||
my ($ent) = $sitetab->getAttribs({ key=>'ppcmaxp'},'value');
|
||||
if ( defined($ent) ) {
|
||||
$maxp = $ent->{value};
|
||||
}
|
||||
($ent) = $sitetab->getAttribs({ key=>'ppctimeout'},'value');
|
||||
if ( defined($ent) ) {
|
||||
$timeout = $ent->{value};
|
||||
}
|
||||
($ent) = $sitetab->getAttribs({ key=>'maxssh'},'value');
|
||||
if ( defined($ent) ) {
|
||||
$maxssh = $ent->{value};
|
||||
foreach ( @site ) {
|
||||
my ($ent) = $sitetab->getAttribs({ key=>$_},'value');
|
||||
if ( defined($ent) ) {
|
||||
$request->{$_} = $ent->{value};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( exists( $request->{verbose} )) {
|
||||
@ -127,7 +128,7 @@ sub process_command {
|
||||
my $sessions;
|
||||
|
||||
foreach ( @$nodes ) {
|
||||
while ( $children > $maxp ) {
|
||||
while ( $children > $request->{ppcmaxp} ) {
|
||||
Time::HiRes::sleep(0.1);
|
||||
}
|
||||
###################################
|
||||
@ -136,13 +137,13 @@ sub process_command {
|
||||
###################################
|
||||
if ( $hw ne @$_[0] ) {
|
||||
$sessions = 1;
|
||||
} elsif ( $sessions++ >= $maxssh ) {
|
||||
Time::HiRes::sleep(0.1);
|
||||
} elsif ( $sessions++ >= $request->{maxssh} ) {
|
||||
sleep(1);
|
||||
$sessions = 1;
|
||||
}
|
||||
$hw = @$_[0];
|
||||
|
||||
my $pipe = fork_cmd( @$_[0], @$_[1], $request, $timeout );
|
||||
my $pipe = fork_cmd( @$_[0], @$_[1], $request );
|
||||
if ( $pipe ) {
|
||||
$fds->add( $pipe );
|
||||
$children++;
|
||||
@ -153,6 +154,7 @@ sub process_command {
|
||||
#######################################
|
||||
while ( $children > 0 ) {
|
||||
child_response( $callback, $fds );
|
||||
Time::HiRes::sleep(0.1);
|
||||
}
|
||||
if ( exists( $request->{verbose} )) {
|
||||
trace( $request, $start );
|
||||
@ -329,7 +331,7 @@ sub preprocess_nodes {
|
||||
# LPAR-by-LPAR basis - fork one process
|
||||
# per LPAR.
|
||||
##########################################
|
||||
if ( $method =~ /^getmacs|rnetboot$/ ) {
|
||||
if ( $method =~ /^(getmacs|rnetboot)$/ ) {
|
||||
while (my ($hcp,$hash) = each(%nodehash) ) {
|
||||
while (my ($mtms,$h) = each(%$hash) ) {
|
||||
while (my ($lpar,$d) = each(%$h)) {
|
||||
@ -621,7 +623,6 @@ sub fork_cmd {
|
||||
my $host = shift;
|
||||
my $nodes = shift;
|
||||
my $request = shift;
|
||||
my $timeout = shift;
|
||||
|
||||
#######################################
|
||||
# Pipe childs output back to parent
|
||||
@ -645,7 +646,7 @@ sub fork_cmd {
|
||||
close( $parent );
|
||||
$request->{pipe} = $child;
|
||||
|
||||
invoke_cmd( $host, $nodes, $request, $timeout );
|
||||
invoke_cmd( $host, $nodes, $request );
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
@ -667,7 +668,6 @@ sub invoke_cmd {
|
||||
my $host = shift;
|
||||
my $nodes = shift;
|
||||
my $request = shift;
|
||||
my $timeout = shift;
|
||||
my $hwtype = $request->{hwtype};
|
||||
my $verbose = $request->{verbose};
|
||||
my @exp;
|
||||
@ -687,7 +687,7 @@ sub invoke_cmd {
|
||||
send_msg( $request, 1, $@ );
|
||||
return;
|
||||
}
|
||||
my @exp = xCAT::PPCfsp::connect( $request, $host, $timeout );
|
||||
my @exp = xCAT::PPCfsp::connect( $request, $host );
|
||||
|
||||
####################################
|
||||
# Error connecting
|
||||
@ -719,7 +719,7 @@ sub invoke_cmd {
|
||||
# Connect to list of remote servers
|
||||
########################################
|
||||
foreach ( split /,/, $host ) {
|
||||
@exp = xCAT::PPCcli::connect( $hwtype, $_, $verbose, $timeout );
|
||||
@exp = xCAT::PPCcli::connect( $request, $hwtype, $_ );
|
||||
|
||||
####################################
|
||||
# Successfully connected
|
||||
@ -833,6 +833,7 @@ sub runcmd {
|
||||
# nodes of the HCPs.
|
||||
##########################################################################
|
||||
sub preprocess_request {
|
||||
|
||||
my $package = shift;
|
||||
my $req = shift;
|
||||
if ($req->{_xcatdest}) { return [$req]; } #exit if preprocessed
|
||||
@ -1001,3 +1002,4 @@ sub process_request {
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user