defect 3851, further enhancements

This commit is contained in:
lissav 2013-10-24 07:15:58 -04:00
parent 95fff778c2
commit 713c85179f

View File

@ -3151,26 +3151,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