From ef8b638460b9777964bdc8121aa051befd150f95 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 27 Jun 2013 04:11:30 +0000 Subject: [PATCH] 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 --- perl-xCAT/xCAT/Utils.pm | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index ebf11a5e6..5bf570a87 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -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;