add check to see if the Management Node is contained in the defined noderange array input
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13447 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
af3efe7170
commit
84ab9da2cf
@ -6452,5 +6452,45 @@ sub pingNodeStatus {
|
||||
|
||||
return %status;
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 noderangecontainsMN
|
||||
Returns:
|
||||
returns nothing, if ManagementNode is not the input noderange
|
||||
returns name of MN, if Management Node is in the input noderange
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Input:
|
||||
array of nodes in the noderange
|
||||
Example:
|
||||
my $mn=xCAT::Utils->noderangecontainsMN($noderange);
|
||||
Comments:
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub noderangecontainsMn
|
||||
{
|
||||
my ($class, @noderange)=@_;
|
||||
# check if any node in the noderange is the Management Node return the
|
||||
# name
|
||||
my $mname;
|
||||
my $tab = xCAT::Table->new('nodetype');
|
||||
my @nodelist=$tab->getAllNodeAttribs(['node','nodetype']);
|
||||
foreach my $n (@nodelist) {
|
||||
if ($n->{'nodetype'} eq "mn") { # this is the MN
|
||||
$mname=$n->{'node'};
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (grep(/$mname/, @noderange)) { # if MN in the noderange
|
||||
return $mname;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user