From 66a4ef81e683d3df8e95d092420eff7df6532214 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 22 Oct 2009 13:53:49 +0000 Subject: [PATCH] fix for 2874219, handling large amounts of data in non-streaming mode git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4439 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/xdsh.pm | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/xdsh.pm b/xCAT-server/lib/xcat/plugins/xdsh.pm index 979272fc9..2ad0c56c4 100644 --- a/xCAT-server/lib/xcat/plugins/xdsh.pm +++ b/xCAT-server/lib/xcat/plugins/xdsh.pm @@ -291,7 +291,6 @@ sub process_request my $args = $request->{arg}; my $envs = $request->{env}; my $rsp = {}; - # get the Environment Variables and set them in the current environment foreach my $envar (@{$request->{env}}) { @@ -334,16 +333,30 @@ sub xdsh { my ($nodes, $args, $callback, $command, $noderange) = @_; - my $rsp = {}; # parse dsh input my @local_results = xCAT::DSHCLI->parse_and_run_dsh($nodes, $args, $callback, $command, $noderange); - push @{$rsp->{data}}, @local_results; - - xCAT::MsgUtils->message("D", $rsp, $callback); - + #print $local_results[0]; + #print "\n"; + #`echo $local_results[0] >> /tmp/lissa/testxdsh`; + my $maxlines=10000; + my $arraylen=@local_results; + my $rsp = {}; + my $i=0; + my $j; + while ($i < $arraylen) { + for ($j = 0 ; $j < $maxlines ; $j++) { + if ($i > $arraylen) { + last; + } else { + $rsp->{data}->[$j]= $local_results[$i]; # send max lines + } + $i++ + } + xCAT::MsgUtils->message("D", $rsp, $callback); + } return; }