From 5d4aa10f7aa277c824e56f4737a9367550aaf4ff Mon Sep 17 00:00:00 2001 From: sakolish Date: Thu, 1 May 2008 19:57:58 +0000 Subject: [PATCH] Staggered forking ssh connects to HMC/IVM - added site.maxssh to control git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1243 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/PPC.pm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/perl-xCAT-2.0/xCAT/PPC.pm b/perl-xCAT-2.0/xCAT/PPC.pm index 27ec6d103..2113a9918 100644 --- a/perl-xCAT-2.0/xCAT/PPC.pm +++ b/perl-xCAT-2.0/xCAT/PPC.pm @@ -83,6 +83,7 @@ sub process_command { my $request = shift; my $maxp = 64; + my $maxssh = 10; my %nodes = (); my $callback = $request->{callback}; my $sitetab = xCAT::Table->new( 'site' ); @@ -101,6 +102,10 @@ sub process_command { if ( defined($ent) ) { $timeout = $ent->{value}; } + ($ent) = $sitetab->getAttribs({ key=>'maxssh'},'value'); + if ( defined($ent) ) { + $maxssh = $ent->{value}; + } } if ( exists( $request->{verbose} )) { $start = Time::HiRes::gettimeofday(); @@ -118,11 +123,25 @@ sub process_command { my $children = 0; $SIG{CHLD} = sub { while (waitpid(-1, WNOHANG) > 0) { $children--; } }; my $fds = new IO::Select; - + my $hw; + my $sessions; + foreach ( @$nodes ) { while ( $children > $maxp ) { Time::HiRes::sleep(0.1); } + ################################### + # sleep between connects to same + # HMC/IVM so as not to overwelm it + ################################### + if ( $hw ne @$_[0] ) { + $sessions = 1; + } elsif ( $sessions++ >= $maxssh ) { + Time::HiRes::sleep(0.1); + $sessions = 1; + } + $hw = @$_[0]; + my $pipe = fork_cmd( @$_[0], @$_[1], $request, $timeout ); if ( $pipe ) { $fds->add( $pipe );