From 3ef70621952c28c36d989e312ba4705c85c06a16 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Sat, 28 Nov 2009 13:06:40 +0000 Subject: [PATCH] -Speed up large noderange expansion git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4685 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/NodeRange.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 01aff7e87..c850637ac 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -34,6 +34,7 @@ my $grptab; my @allnodeset; my %allnodehash; my @grplist; +my $didgrouplist; my %allgrphash; my $retaincache=0; my $recurselevel=0; @@ -182,7 +183,8 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels unless ($grptab) { $grptab = xCAT::Table->new('nodegroup'); } - if ($grptab and not scalar @grplist) { + if ($grptab and not $didgrouplist and not scalar @grplist) { + $didgrouplist = 1; @grplist = @{$grptab->getAllEntries()}; } my $isdynamicgrp = 0; @@ -371,7 +373,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels } foreach ($leftarr[$idx]..$rightarr[$idx]) { my @addnodes=expandatom($prefix.$_.$luffix,$verify); - @nodes=(@nodes,@addnodes); + push @nodes,@addnodes; } return (@nodes); #the return has been built, return, exiting loop and all }