diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 984329810..a05a3bbc9 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -509,7 +509,12 @@ sub noderange { $missingnodes=[]; #We for now just do left to right operations my $range=shift; - my $verify = (scalar(@_) == 1 ? shift : 1); + my $verify = (scalar(@_) >= 1 ? shift : 1); + + #excludenodes attribute in site table, + #these nodes should be excluded for any xCAT commands + my $exsitenode = (scalar(@_) >= 1 ? shift : 1); + unless ($nodelist) { $nodelist =xCAT::Table->new('nodelist',-create =>1); $nodelist->_set_use_cache(0); #TODO: a more proper external solution @@ -573,6 +578,27 @@ sub noderange { } # end of main while loop + + # Exclude the nodes in site attribute excludenodes? + if ($exsitenode) { + my $badnoderange = 0; + my @badnodes = (); + my $sitetab = xCAT::Table->new('site',-create=>0); + if ($sitetab) { + my ($ref) = $sitetab->getAttribs({key => 'excludenodes'}, 'value'); + if ($ref and $ref->{value}) { + $badnoderange = $ref->{value}; + # use the exsitenode argument to exit recursion + @badnodes = noderange($badnoderange, 1, 0); + foreach my $bnode (@badnodes) { + if (!$delnodes{$bnode}) { + $delnodes{$bnode} = 1; + } + } + } + } + } + # Now remove all the exclusion nodes foreach (keys %nodes) { if ($delnodes{$_}) { diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 7f329962d..348d13831 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -774,6 +774,10 @@ site => { " events to if the primary HMC is down.\n\n". " enableASMI: (yes/1 or no/0). If yes, ASMI method will be used after fsp-api. If no,\n". " when fsp-api is used, ASMI method will not be used. Default is no.\n\n". + " excludenodes: A set of comma separated nodes and/or groups that would automatically\n". + " be subtracted from any noderange, it can be used for excluding some\n". + " failed nodes for any xCAT commands. See the 'noderange' manpage for\n". + " details on supported formats.\n\n". " forwarders: The DNS servers at your site that can provide names outside of the\n". " cluster. The DNS on the management node will forward requests it\n". " does not know to these servers.\n\n".