add a subroutine filter_nostatusupdate to support updating provision status thru feedback instead of rpower/rnetboot

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16788 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
immarvin 2013-06-27 04:11:30 +00:00
parent de974743c9
commit ef8b638460

View File

@ -3289,4 +3289,61 @@ sub filter_nodes{
return 0;
}
#-------------------------------------------------------------------------------
=head3 filter_nostatusupdate()
filter out the nodes which support provision status feedback from the status-nodes hash
Returns:
returns the filtered status-nodes hash
Globals:
none
Error:
none
Input:
the ref of status-nodes hash to filter
Example:
my $mn=xCAT::Utils->filter_nostatusupdate(\%statusnodehash);
Comments:
=cut
#-------------------------------------------------------------------------------
sub filter_nostatusupdate{
my ($class,$inref)=@_;
my $nttabdata;
my @allnodes=();
#read "nodetype" table to get the "os" attribs for all the nodes with status "installing" or "netbooting"
if(exists $inref->{$::STATUS_INSTALLING}){
push @allnodes, @{$inref->{$::STATUS_INSTALLING}};
}
if(exists $inref->{$::STATUS_NETBOOTING}){
push @allnodes, @{$inref->{$::STATUS_NETBOOTING}};
}
my $nodetypetab = xCAT::Table->new('nodetype');
if ($nodetypetab) {
$nttabdata = $nodetypetab->getNodesAttribs(\@allnodes, ['node', 'os']);
$nodetypetab->close();
}
#filter out the nodes which support the node provision status feedback
my @nodesfiltered=();
if(exists $inref->{$::STATUS_INSTALLING}){
map{ if($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|sles)/) {push @nodesfiltered,$_;} } @{$inref->{$::STATUS_INSTALLING}};
delete $inref->{$::STATUS_INSTALLING};
if(@nodesfiltered){
($inref->{$::STATUS_INSTALLING})=@nodesfiltered;
}
}
@nodesfiltered=();
if(exists $inref->{$::STATUS_NETBOOTING}){
map{ if($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|sles)/) {push @nodesfiltered,$_;} } @{$inref->{$::STATUS_NETBOOTING}};
delete $inref->{$::STATUS_NETBOOTING};
if(@nodesfiltered){
($inref->{$::STATUS_NETBOOTING})=@nodesfiltered;
}
}
}
1;