From 5892e901454dd83751a3cf6e568d0daf9e2eb31e Mon Sep 17 00:00:00 2001 From: yinle Date: Wed, 16 Feb 2011 10:04:51 +0000 Subject: [PATCH] FSP/BPA redundancy: add a function to getchildren git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8854 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DBobjUtils.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 653c4670b..12b62f28d 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -2045,6 +2045,7 @@ sub parse_access_tabentry() =head3 getchildren returns fsp(or bpa) of the specified cec(or frame), + if specified port, it will just return nodes within the port. Arguments: none Returns: @@ -2063,11 +2064,13 @@ sub parse_access_tabentry() sub getchildren { my $parent = shift; + my $port = shift; if (($parent) && ($parent =~ /xCAT::/)) { $parent = shift; } my @children = (); + my @children_prot = (); if (!%::PARENT_CHILDREN) { my $ppctab = xCAT::Table->new( 'ppc' ); my @ps = $ppctab->getAllNodeAttribs(['node','parent']); @@ -2092,7 +2095,22 @@ sub getchildren } } } - return \@children; + unless ( $port ) + { + return \@children; + } else + { + my $vpdtab = xCAT::Table->new( 'vpd' ); + my $sides = $vpdtab->getNodesAttribs(\@children, ['side']); + for my $n (@children) + { + if ($sides->{$n}->{side} =~ /$port/) + { + push @children_prot, $n; + } + } + return \@children_prot; + } } #-------------------------------------------------------------------------------