From 206746b6c1d8484aedcda4998bb4396c21671c1e Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Fri, 29 Jun 2012 08:45:26 +0000 Subject: [PATCH] fix bug 3519576:Performance improvement to blade.pm git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@13205 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index b85cc13f7..312f60706 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -1348,7 +1348,7 @@ sub rscan { return( join('',($_[0],$usage_string))); }; - if ( !GetOptions(\%opt,qw(V|Verbose w x z u))){ + if ( !GetOptions(\%opt,qw(V|verbose w x z u))){ return(1,usage()); } if ( defined($ARGV[0]) ) { @@ -4381,13 +4381,21 @@ sub get_blades_for_mpa { return undef; } my @nodearray = $mptab->getAttribs({mpa=>$mpa,nodetype=>"blade"}, qw(node)); + my @blades = (); + my $nodesattrs; if (!defined(@nodearray)) { return (\%blades_hash); + } else { + foreach (@nodearray) { + if (defined($_->{node})) { + push @blades, $_->{node}; + } + } + $nodesattrs = $ppctab->getNodesAttribs(\@blades, \@attribs); } - foreach (@nodearray) { - my $node = $_->{node}; + foreach my $node (@blades) { + my $att = $nodesattrs->{$node}->[0]; my @values = (); - my ($att) = $ppctab->getNodeAttribs($node, \@attribs); if (!defined($att)) { next; } elsif ($att and $att->{parent} and ($att->{parent} ne $mpa)) {