FSP/BPA redundancy: add sub function to get the CECs located in a specified Frame.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8494 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
yinle 2010-12-21 07:34:25 +00:00
parent 983701c21f
commit b1e92f9885

View File

@ -2185,4 +2185,57 @@ sub getnodetype
}
return undef;
}
#-------------------------------------------------------------------------------
=head3 getcecchildren
returns cec of the specified frame,
Arguments:
none
Returns:
refrence of cec hostnames
Globals:
$::PARENT_CHILDREN_CEC
Error:
none
Example:
$c1 = getcecchildren($nodetocheck);
Comments:
none
=cut
#-------------------------------------------------------------------------------
sub getcecchildren
{
my $parent = shift;
if (($parent) && ($parent =~ /xCAT::/))
{
$parent = shift;
}
my @children = ();
if (!%::PARENT_CHILDREN_CEC) {
my $ppctab = xCAT::Table->new( 'ppc' );
my @ps = $ppctab->getAllNodeAttribs(['node','parent']);
for my $entry ( @ps ) {
my $p = $entry->{parent};
my $c = $entry->{node};
if ( $p and $c) {
my $type = $ppctab->getNodeAttribs($c, ["nodetype"]);
if ( $type and ($type->{nodetype} eq 'cec'))
{
push @{$::PARENT_CHILDREN_CEC{$p}}, $c;
}
}
}
foreach (@{$::PARENT_CHILDREN_CEC{$parent}}) {
push @children, $_;
}
} else {
if (exists($::PARENT_CHILDREN_CEC{$parent})) {
foreach (@{$::PARENT_CHILDREN_CEC{$parent}}) {
push @children, $_;
}
}
}
return \@children;
}
1;