FSP/BPA redundancy: Add the part of find IP address of Frame/CEC
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8345 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
dee114fd37
commit
86959f995b
@ -2799,13 +2799,115 @@ sub getNodeIPaddress
|
||||
}
|
||||
}
|
||||
|
||||
#modified by yinle, need to make sure that user would not define
|
||||
#cec and frame in hosts table
|
||||
my @children;
|
||||
my $c1;
|
||||
my $ips;
|
||||
unless ( $nodeip ) {
|
||||
my $nttab = xCAT::Table->new('nodetype');
|
||||
if ( $nttab ) {
|
||||
my $type = $nttab->getNodeAttribs($nodetocheck, ['nodetype']);
|
||||
if ($type) {
|
||||
if ($type->{nodetype} eq "frame" or $type->{nodetype} eq "cec") {
|
||||
$c1 = getchildren($nodetocheck);
|
||||
if ( $c1 ) {
|
||||
$ips = join ",", @$c1;
|
||||
return \$ips;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( $nodeip ) {
|
||||
return $nodeip;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getchildren
|
||||
returns fsp(or bpa) of the specified cec(or frame),
|
||||
only support the condition that definition of fsp/bpa is IP address.
|
||||
Arguments:
|
||||
none
|
||||
Returns:
|
||||
refrence of fsp/bpa hostnames (IPs)
|
||||
Globals:
|
||||
%PARENT_CHILDREN
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
$c1 = getchildren($nodetocheck);
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub getchildren
|
||||
{
|
||||
my $parent = shift;
|
||||
my @children = ();
|
||||
if (!%::PARENT_CHILDREN) {
|
||||
my $ppctab = xCAT::Table->new( 'ppc' );
|
||||
my @ps = $ppctab->getAllNodeAttribs(['node','parent']);
|
||||
for my $entry ( @ps ) {
|
||||
my $p = $entry->{parent};
|
||||
my $c = $entry->{node};
|
||||
#just return fsp or bpa, need to make sure
|
||||
#we won't allow user to define fsp/bpa
|
||||
if ( $p and ($c =~ /\d+\.\d+\.\d+\.\d+/)) {
|
||||
push @{$::PARENT_CHILDREN{$p}}, $c;
|
||||
}
|
||||
}
|
||||
foreach (@{$::PARENT_CHILDREN{$parent}}) {
|
||||
push @children, $_;
|
||||
}
|
||||
} else {
|
||||
if (exists($::PARENT_CHILDREN{$parent})) {
|
||||
foreach (@{$::PARENT_CHILDREN{$parent}}) {
|
||||
push @children, $_;
|
||||
}
|
||||
}
|
||||
}
|
||||
return \@children;
|
||||
}
|
||||
|
||||
##-------------------------------------------------------------------------------
|
||||
#
|
||||
#=head3 getparent
|
||||
# still need to deside if needed
|
||||
#=cut
|
||||
#
|
||||
##-------------------------------------------------------------------------------
|
||||
#
|
||||
#sub getparent
|
||||
#{
|
||||
# my $child = shift;
|
||||
# my $parent;
|
||||
# if (!%::CHILDREN_PARENT) {
|
||||
# my $ppctab = xCAT::Table->new( 'ppc' );
|
||||
# my @ps = $ppctab->getAllNodeAttribs(['node','parent']);
|
||||
# for my $entry ( @ps ) {
|
||||
# my $c = $entry->{node};
|
||||
# my $p = $entry->{parent};
|
||||
# if ( $p ) ) {
|
||||
# $::CHILDREN_PARENT{$c} = $p;
|
||||
# }
|
||||
# }
|
||||
# } else {
|
||||
# if (exists($::CHILDREN_PARENT{$child})) {
|
||||
# $parent = $::CHILDREN_PARENT{$child};
|
||||
# }
|
||||
# }
|
||||
# return \$parent;
|
||||
#}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 thishostisnot
|
||||
|
Loading…
Reference in New Issue
Block a user