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:
		| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user