diff --git a/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm b/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm index fabec9f9f..b4034144e 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm @@ -4316,6 +4316,40 @@ sub loadsdrcache { } +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; diff --git a/xCAT-server-2.0/sbin/xcatd b/xCAT-server-2.0/sbin/xcatd index e57e88fb9..978e1af7b 100755 --- a/xCAT-server-2.0/sbin/xcatd +++ b/xCAT-server-2.0/sbin/xcatd @@ -562,10 +562,16 @@ sub plugin_command { 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 @@ sub dispatch_request { $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); } } }