From 165ac01821e8982917ea693481f80a8b9f846171 Mon Sep 17 00:00:00 2001 From: yinle Date: Fri, 10 Feb 2012 08:53:15 +0000 Subject: [PATCH] "getnodetype performance improvement": change getnodetype related code. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11541 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/dhcp.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 9ed8aa354..93007eb4e 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -733,7 +733,6 @@ sub preprocess_request foreach my $n (@nodes) { # get the nodetype for each node - #my $ntype = xCAT::DBobjUtils->getnodetype($n); my $ntable = xCAT::Table->new('nodetype'); if ($ntable) { my $mytype = $ntable->getNodeAttribs($n,['nodetype']); @@ -1177,9 +1176,10 @@ sub process_request if ($req->{node}) { #@inodes = split /,/,${$req->{noderange}}; + my $typehash = xCAT::DBobjUtils->getnodetype(\@{$req->{node}}); foreach $pnode(@{$req->{node}}) { - my $ntype = xCAT::DBobjUtils->getnodetype($pnode); + my $ntype = $$typehash{$pnode}; if ($ntype =~ /^(cec|frame)$/) { $cnode = xCAT::DBobjUtils->getchildren($pnode); @@ -1202,10 +1202,15 @@ sub process_request $req->{node} = []; my $nodelist = xCAT::Table->new('nodelist'); my @entries = ($nodelist->getAllNodeAttribs([qw(node)])); + my @nodeentries; + foreach (@entries) { + push @nodeentries, $_->{node}; + } + my $typehash = xCAT::DBobjUtils->getnodetype(\@nodeentries); foreach (@entries) { #delete the CEC and Frame node - my $ntype = xCAT::DBobjUtils->getnodetype($_->{node}); + my $ntype = $$typehash{$_->{node}}; unless ($ntype =~ /^(cec|frame)$/) { push @{$req->{node}}, $_->{node}; @@ -1235,7 +1240,6 @@ sub process_request foreach my $n (@{$req->{node}}) { # get the nodetype for each node - #my $ntype = xCAT::DBobjUtils->getnodetype($n); my $ntable = xCAT::Table->new('nodetype'); if ($ntable) { my $ntype = $ntable->getNodeAttribs($n,['nodetype']);