From 4abd98423eb3d0f6543ab8b5bb31e8a055b9cc61 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 9 Apr 2010 19:14:36 +0000 Subject: [PATCH] fix defect 2983190, list_all_node_groups should check both the nodelist and nodegroup table git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5735 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 698520924..7d29bd966 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -575,7 +575,8 @@ sub list_all_nodes Arguments: Returns: - an array of all define node groups from the nodelist table + an array of all define node groups from the nodelist and nodegroup + table Globals: none Error: @@ -618,6 +619,28 @@ sub list_all_node_groups xCAT::MsgUtils->message("E", " Could not read the nodelist table\n"); } $nodelisttab->close; + # now read the nodegroup table + if ($nodelisttab = xCAT::Table->new("nodegroup")) + { + my @attribs = ("groupname"); + @grouplist = $nodelisttab->getAllAttribs(@attribs); + + # build a distinct list of unique group names + foreach my $group (@grouplist) + { + my $groupname = $group->{groupname}; + if (!grep(/$groupname/, @distinctgroups)) + { # not already in list + push @distinctgroups, $groupname; + } + } + $nodelisttab->close; + } + else + { + xCAT::MsgUtils->message("E", " Could not read the nodegroup table\n"); + } + return @distinctgroups; }