"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
This commit is contained in:
yinle 2012-02-10 08:53:15 +00:00
parent 5a0565c8cb
commit 165ac01821

View File

@ -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']);