From: <jbj...@us...> - 2008-01-25 16:17:18
|
Revision: 326 http://xcat.svn.sourceforge.net/xcat/?rev=326&view=rev Author: jbjohnso Date: 2008-01-25 08:17:19 -0800 (Fri, 25 Jan 2008) Log Message: ----------- Make ipmi requests fan out to service nodes, fix problem where serverdone flags were erroneously propogated to client from a dispatched request Modified Paths: -------------- xcat-core/trunk/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm xcat-core/trunk/xCAT-server-2.0/sbin/xcatd Modified: xcat-core/trunk/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm =================================================================== --- xcat-core/trunk/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm 2008-01-25 15:57:14 UTC (rev 325) +++ xcat-core/trunk/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm 2008-01-25 16:17:19 UTC (rev 326) @@ -4316,6 +4316,40 @@ } +sub preprocess_request { + my $request = shift; + my @requests; + my %servicenodehash; + my %noservicenodehash; + my $nrtab = xCAT::Table->new('noderes'); + foreach my $node (@{$request->{node}}) { + my $tent = $nrtab->getNodeAttribs($node,['servicenode']); + if ($tent and $tent->{servicenode}) { + $servicenodehash{$tent->{servicenode}}->{$node} = 1; + } else { + $noservicenodehash{$node} = 1; + } + } + foreach my $smaster (keys %servicenodehash) { + my $reqcopy = {%$request}; + $reqcopy->{'_xcatdest'} = $smaster; + $reqcopy->{node} = [ keys %{$servicenodehash{$smaster}} ]; + push @requests,$reqcopy; + } + my $reqcopy = {%$request}; + $reqcopy->{node} = [ keys %noservicenodehash ]; + if ($reqcopy->{node}) { + push @requests,$reqcopy; + } + return \@requests; +} + + + + + + + sub process_request { my $request = shift; my $callback = shift; Modified: xcat-core/trunk/xCAT-server-2.0/sbin/xcatd =================================================================== --- xcat-core/trunk/xCAT-server-2.0/sbin/xcatd 2008-01-25 15:57:14 UTC (rev 325) +++ xcat-core/trunk/xCAT-server-2.0/sbin/xcatd 2008-01-25 16:17:19 UTC (rev 326) @@ -562,10 +562,16 @@ if ($sock) { print $sock XMLout(\%done,RootName => 'xcatresponse',NoAttr=>1); } } - +my $dispatch_cb; +sub dispatch_callback { + my $rsp = shift; + delete $rsp->{serverdone}; + $dispatch_cb->($rsp); +} sub dispatch_request { my $req = shift; - my $callback = shift; + $dispatch_cb = shift; + my $modname = shift; my $reqs = []; no strict "refs"; @@ -591,15 +597,15 @@ $ENV{XCATHOST} = ( $_->{'_xcatdest'} =~ /:/ ? $_->{'_xcatdest'} : $_->{'_xcatdest'}.":3001" ); eval { undef $_->{'_xcatdest'}; - xCAT::Client::submit_request($_,$callback,$xcatdir."/cert/server-key.pem",$xcatdir."/cert/server-cert.pem",$xcatdir."/cert/ca.pem"); + xCAT::Client::submit_request($_,\&dispatch_callback,$xcatdir."/cert/server-key.pem",$xcatdir."/cert/server-cert.pem",$xcatdir."/cert/ca.pem"); }; if ($@) { - $callback->({error=>["Error dispatching command to ".$ENV{XCATHOST}.""],errorcode=>[1]}); + $dispatch_cb->({error=>["Error dispatching command to ".$ENV{XCATHOST}.""],errorcode=>[1]}); syslog("local4|err","Error dispatching request: ".$@); } $ENV{XCATHOST} = $oldenv; } else { - ${"xCAT_plugin::".$modname."::"}{process_request}->($_,$callback,\&do_request); + ${"xCAT_plugin::".$modname."::"}{process_request}->($_,$dispatch_cb,\&do_request); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |