From c7f18f612daa910d68549adc34aec88861e4c91d Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 11 May 2012 14:15:06 +0000 Subject: [PATCH] Fix problem where group mapping may get stuck under certain circumstances git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12630 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/NodeRange.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 4c7e0a428..4895381fd 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -37,6 +37,7 @@ my %allnodehash; my @grplist; my $didgrouplist; my %allgrphash; +my $allgrphashstamp; my $retaincache=0; my $recurselevel=0; @@ -237,7 +238,8 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels # The atom is not a dynamic node group, is it a static node group??? if(!$isdynamicgrp) { - unless (scalar %allgrphash) { #build a group membership cache + unless (scalar %allgrphash and (time() < ($allgrphashstamp+5))) { #build a group membership cache + $allgrphashstamp=time(); my $nlent; foreach $nlent (@allnodeset) { my @groups=split(/,/,$nlent->{groups}); @@ -540,7 +542,7 @@ sub noderange { $nodelist =xCAT::Table->new('nodelist',-create =>1); $nodelist->_set_use_cache(0); #TODO: a more proper external solution @cachedcolumns = ('node','groups'); - $nodelist->_build_cache(\@cachedcolumns); + $nodelist->_build_cache(\@cachedcolumns,noincrementref=>1); $nodelist->_set_use_cache(1); #TODO: a more proper external solution } my %nodes = (); @@ -624,9 +626,9 @@ sub noderange { if ($recurselevel) { $recurselevel--; } else { - unless ($retaincache) { - retain_cache(0); - } + #unless ($retaincache) { + # retain_cache(0); + #} } return sort (keys %nodes);