From d1a0979da2b3d9d399543c3070f4fafbdd2193be Mon Sep 17 00:00:00 2001 From: sakolish Date: Tue, 22 Apr 2008 15:50:22 +0000 Subject: [PATCH] Added site.ppctimeout to control connect/command timeout git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1151 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/PPC.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/PPC.pm b/perl-xCAT-2.0/xCAT/PPC.pm index beef70be6..27ec6d103 100644 --- a/perl-xCAT-2.0/xCAT/PPC.pm +++ b/perl-xCAT-2.0/xCAT/PPC.pm @@ -87,6 +87,7 @@ sub process_command { my $callback = $request->{callback}; my $sitetab = xCAT::Table->new( 'site' ); my $start; + my $timeout; ####################################### # Get max processes to fork @@ -96,6 +97,10 @@ sub process_command { if ( defined($ent) ) { $maxp = $ent->{value}; } + ($ent) = $sitetab->getAttribs({ key=>'ppctimeout'},'value'); + if ( defined($ent) ) { + $timeout = $ent->{value}; + } } if ( exists( $request->{verbose} )) { $start = Time::HiRes::gettimeofday(); @@ -118,7 +123,7 @@ sub process_command { while ( $children > $maxp ) { Time::HiRes::sleep(0.1); } - my $pipe = fork_cmd( @$_[0], @$_[1], $request ); + my $pipe = fork_cmd( @$_[0], @$_[1], $request, $timeout ); if ( $pipe ) { $fds->add( $pipe ); $children++; @@ -597,6 +602,7 @@ sub fork_cmd { my $host = shift; my $nodes = shift; my $request = shift; + my $timeout = shift; ####################################### # Pipe childs output back to parent @@ -620,7 +626,7 @@ sub fork_cmd { close( $parent ); $request->{pipe} = $child; - invoke_cmd( $host, $nodes, $request ); + invoke_cmd( $host, $nodes, $request, $timeout ); exit(0); } else { @@ -642,6 +648,7 @@ 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; @@ -661,7 +668,7 @@ sub invoke_cmd { send_msg( $request, 1, $@ ); return; } - my @exp = xCAT::PPCfsp::connect( $request, $host ); + my @exp = xCAT::PPCfsp::connect( $request, $host, $timeout ); #################################### # Error connecting @@ -693,7 +700,7 @@ sub invoke_cmd { # Connect to list of remote servers ######################################## foreach ( split /,/, $host ) { - @exp = xCAT::PPCcli::connect( $hwtype, $_, $verbose ); + @exp = xCAT::PPCcli::connect( $hwtype, $_, $verbose, $timeout ); #################################### # Successfully connected @@ -974,3 +981,4 @@ sub process_request { +