From 4bac6666750eff57f097871e0d7470e60f7508b3 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 24 Oct 2013 07:23:59 -0400 Subject: [PATCH] defect 3851, further enhancements --- perl-xCAT/xCAT/Utils.pm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index fd6052a90..558df696f 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3174,7 +3174,7 @@ sub isSELINUX Input: array of nodes in the noderange Example: - my $mn=xCAT::Utils->noderangecontainsMN($noderange); + my @mn=xCAT::Utils->noderangecontainsMN($noderange); Comments: =cut @@ -3183,26 +3183,30 @@ sub noderangecontainsMn { my ($class, @noderange)=@_; # check if any node in the noderange is the Management Node return the - # name - my $mname; + # name + my @mnames; # management node names in the database, members of __mgmtnode my $tab = xCAT::Table->new('nodelist'); my @nodelist=$tab->getAllNodeAttribs(['node','groups']); foreach my $n (@nodelist) { if (defined($n->{'groups'})) { my @groups=split(",",$n->{'groups'}); if ((grep (/__mgmtnode/,@groups))) { # this is the MN - $mname=$n->{'node'}; - last; + push @mnames,$n->{'node'}; } } } - if ($mname) { # if Management Node defined in the database - if (grep(/^$mname$/, @noderange)) { # if MN in the noderange - return $mname; - } else { - return ; + my @MNs; # management node names found the noderange + if (@mnames) { # if any Management Node defined in the database + foreach my $mn (@mnames) { + if (grep(/^$mn$/, @noderange)) { # if MN in the noderange + push @MNs, $mn; + } + } + if (@MNs) { # management nodes in the noderange + return @MNs; } } + return; # if no MN in the noderange, return nothing } =head3 filter_nodes