From df00eacd349fb0a436eb855aaae8541117b84f69 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 23 Apr 2008 19:11:16 +0000 Subject: [PATCH] Add routine for getting a list of all service nodes get_AllSN git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1174 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/Utils.pm | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/perl-xCAT-2.0/xCAT/Utils.pm b/perl-xCAT-2.0/xCAT/Utils.pm index 9e80f2959..fa4a4fe18 100644 --- a/perl-xCAT-2.0/xCAT/Utils.pm +++ b/perl-xCAT-2.0/xCAT/Utils.pm @@ -2152,4 +2152,45 @@ sub isSN $nodelisttab->close; return 0; } + +#----------------------------------------------------------------------------- + +=head3 get_AllSN + + Returns an array of all service nodes + + Arguments: + none + Returns: + array of Service Nodes or empty array, if none + Globals: + none + Error: + 1 - error + Example: + @allSN=xCAT::Utils->get_AllSN + Comments: + none + +=cut + +#----------------------------------------------------------------------------- +sub get_AllSN +{ + + # read the node from the nodelist table and see if it + # is a member of the service group + my @servicenodes; + my $nodelisttab = xCAT::Table->new('nodelist'); + my $recs = $nodelisttab->getAllEntries(); + foreach (@$recs) + { + if (grep /service/, $_->{groups}) + { # in service group + push @servicenodes, $_->{node}; + } + } + $nodelisttab->close; + return @servicenodes; +} 1;