From ba01bb554a702ad968adabd92ed016bb5338fbe6 Mon Sep 17 00:00:00 2001 From: yinle Date: Fri, 10 Feb 2012 10:04:37 +0000 Subject: [PATCH] "getnodetype performance improvement": change getnodetype related code. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11545 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/hmc.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/hmc.pm b/xCAT-server/lib/xcat/plugins/hmc.pm index 96262b421..a337e8c0e 100644 --- a/xCAT-server/lib/xcat/plugins/hmc.pm +++ b/xCAT-server/lib/xcat/plugins/hmc.pm @@ -90,7 +90,7 @@ sub gethmccon { ################################# # Get node type ################################# - my $type = xCAT::DBobjUtils->getnodetype($node); + my $type = xCAT::DBobjUtils->getnodetype($node, "ppc"); #my ($type) = grep( /^(lpar|osi)$/, @types ); if ( !defined( $type ) or !($type =~/lpar/) ) { @@ -202,11 +202,17 @@ sub genhwtree ################################################################## # only handle physical hardware objects here. + my $typehash = xCAT::DBobjUtils->getnodetype(\@$nodelist, "ppc"); + my @ppcnodes; + foreach (@entries) { + push @ppcnodes, $_->{node}; + } + my $entnodetypehash = xCAT::DBobjUtils->getnodetype(\@ppcnodes, "ppc"); foreach my $node (@$nodelist) { # will build a hash like hmc->frame->cec # for old xcat defs, ppc.nodetype may be blank, should use getnodetype(). - my $ntype = xCAT::DBobjUtils->getnodetype($node); + my $ntype = $$typehash{$node}; if ($ntype =~ /^hmc$/) { # get all objects managed by this hmc. @@ -214,7 +220,7 @@ sub genhwtree { if ($ent->{hcp} =~ /$node/) { - my $type = xCAT::DBobjUtils->getnodetype($ent->{node}); + my $type = $$entnodetypehash{$ent->{node}}; # use cec as leaves if ($type =~ /cec/) {