From 68671563d7231b1121341c58f89ede43b9956b28 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 18 Jul 2008 19:25:15 +0000 Subject: [PATCH] -Speed up nodels at scale -Have nodels report multiple equally valid records for a node when encountered git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1898 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/tabutils.pm | 39 +++++++++++++++--------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index af47a3b42..a3fcfa592 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -847,25 +847,34 @@ sub nodels #print Dumper($tables{$tab}); my $node; + my %labels; + foreach (@{$tables{$tab}}) + { + push @cols, $_->[0]; + $labels{$_->[0]} = $_->[1]; + } + my $removenodecol=1; + if (grep /^node$/,@cols) { + $removenodecol=0; + } + my $rechash=$tabh->getNodesAttribs($nodes,\@cols); foreach $node (@$nodes) { my @cols; - my %labels; - foreach (@{$tables{$tab}}) - { - push @cols, $_->[0]; - $labels{$_->[0]} = $_->[1]; - } - my $rec = $tabh->getNodeAttribs($node, \@cols); - foreach (keys %$rec) - { - my %datseg; - unless ($terse > 0) { - $datseg{data}->[0]->{desc} = [$labels{$_}]; + my $recs = $rechash->{$node}; #$tabh->getNodeAttribs($node, \@cols); + foreach my $rec (@$recs) { + + foreach (keys %$rec) + { + if ($_ eq "node" and $removenodecol) { next; } + my %datseg; + unless ($terse > 0) { + $datseg{data}->[0]->{desc} = [$labels{$_}]; + } + $datseg{data}->[0]->{contents} = [$rec->{$_}]; + $datseg{name} = [$node]; #{}->{contents} = [$rec->{$_}]; + push @{$noderecs{$node}}, \%datseg; } - $datseg{data}->[0]->{contents} = [$rec->{$_}]; - $datseg{name} = [$node]; #{}->{contents} = [$rec->{$_}]; - push @{$noderecs{$node}}, \%datseg; } }