diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 913fc3a65..da9c7dc45 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -32,13 +32,13 @@ my $grptab; #my $nodeprefix = "node"; my @allnodeset; -my $allnodesetstamp=0; my %allnodehash; my @grplist; my $didgrouplist; my $glstamp=0; +my $allnodesetstamp=0; +my $allgrphashstamp=0; my %allgrphash; -my $allgrphashstamp; my $retaincache=0; my $recurselevel=0; @@ -448,7 +448,10 @@ sub retain_cache { #A semi private operation to be used *ONLY* in the interestin $retaincache=shift; unless ($retaincache) { #take a call to retain_cache(0) to also mean that any existing #cache must be zapped - if ($nodelist) { $nodelist->_clear_cache(); } + if ($nodelist) { $nodelist->_refresh_cache(); } + $glstamp=0; + $allnodesetstamp=0; + $allgrphashstamp=0; undef $nodelist; @allnodeset=(); %allnodehash=(); diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index c58f698ed..a22a86315 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -986,6 +986,7 @@ sub plugin_command { if ($req->{node}) { @nodes = @{$req->{node}}; } elsif ($req->{noderange} and $req->{noderange}->[0]) { + xCAT::NodeRange::retain_cache(0); #if the request has a 'noderange' element, take the performance hit for the sake of freshness @nodes = noderange($req->{noderange}->[0]); if (nodesmissed) { my $rsp = {errorcode=>1,error=>"Invalid nodes and/or groups in noderange: ".join(',',nodesmissed)}; @@ -1716,7 +1717,7 @@ sub service_connection { if (not defined $bytesread and $! == EAGAIN) { next; } # last; } - my $flags=fcntl($sock,F_GETFL,0); + $flags=fcntl($sock,F_GETFL,0); $flags &= ~O_NONBLOCK; #now we want *print* to be blocking IO fcntl($sock,F_SETFL,$flags); $request .= $line; @@ -1765,6 +1766,7 @@ sub service_connection { } elsif ($cmd_handlers{$req->{command}->[0]}) { plugin_command($req,$sock,\&convey_response); } elsif ($req->{command}->[0] eq "noderange" and $req->{noderange}) { + xCAT::NodeRange::retain_cache(0); #if the request has a 'noderange' element, take the performance hit for the sake of freshness my @nodes = noderange($req->{noderange}->[0]); my %resp; if (nodesmissed) {