"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
This commit is contained in:
yinle 2012-02-10 10:04:37 +00:00
parent 2e0c3640ac
commit ba01bb554a

View File

@ -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/)
{