add routine to divide nodelist into service and non-service nodes

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13607 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2012-08-24 16:50:07 +00:00
parent c919a2cd2a
commit 7ee8876bfd

View File

@ -181,7 +181,7 @@ sub isServiceReq
Error:
1 - error
Example:
@allSN=xCAT::ServiceNodeUtils->get_AllSN
@allSN=xCAT::ServiceNodeUtils->getAllSN
Comments:
none
@ -684,4 +684,45 @@ sub getSNformattedhash
}
return \%newsnhash;
}
#-----------------------------------------------------------------------------
=head3
getSNandCPnodes - Take an array of nodes and returns
an array of the service
nodes and an array of the computenode .
Arguments:
none
Returns:
array of Service Nodes and/or array of compute nodesarray of compute nodes empty array, if none
Globals:
none
Error:
1 - error
Example:
xCAT::ServiceNodeUtils->getSNandCPnodes(\@nodes,\@SN,\@CN);
Comments:
none
=cut
#-----------------------------------------------------------------------------
sub getSNandCPnodes
{
my ($class, $nodes,$sn,$cn) = @_;
my @nodelist = @$nodes;
# get the list of all Service nodes
@allSN=xCAT::ServiceNodeUtils->getAllSN;
foreach $node (@nodelist) {
if (grep(/^$node$/, @allSN)) { # it is a SN
push (@$sn,$node);
} else { # a CN
push (@$cn,$node);
}
}
return ;
}
1;