diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 05913c0ce..db062ed58 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -277,20 +277,28 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels return(@nodes); } - if ($atom =~ m/(.*)\[(.*)\](.*)/) { # square bracket range - #for the time being, we are only going to consider one [] per atom - #xcat 1.2 does no better + if ($atom =~ m/(.+?)\[(.+?)\](.*)/) { # square bracket range + # if there are more than 1 [], we picked off just the 1st. if there is another, we will process it later my @subelems = split(/([\,\-\:])/,$2); my $subrange=""; my $subelem; + my $start = $1; + my $ending = $3; + my $morebrackets = $ending =~ /\[.+?\]/; # if there are more brackets, we have to expand just the 1st part, then add the 2nd part later while (scalar @subelems) { my $subelem = shift @subelems; my $subop=shift @subelems; - $subrange=$subrange."$1$subelem$3$subop"; + $subrange=$subrange."$start$subelem" . ($morebrackets?'':$ending) . "$subop"; } foreach (split /,/,$subrange) { - my @newnodes=expandatom($_,$verify); - @nodes=(@nodes,@newnodes); + my @newnodes=expandatom($_, ($morebrackets?0:$verify)); + if (!$morebrackets) { push @nodes,@newnodes; } + else { + # for each of the new nodes, add the 2nd brackets and then expand + foreach my $n (@newnodes) { + push @nodes, expandatom("$n$ending", $verify); + } + } } return @nodes; } @@ -398,8 +406,8 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels } } - push @$missingnodes,$atom; if ($verify) { + push @$missingnodes,$atom; return (); } else { return ($atom); diff --git a/xCAT-client/pods/man3/noderange.3.pod b/xCAT-client/pods/man3/noderange.3.pod index 10d7058a7..f80504f79 100644 --- a/xCAT-client/pods/man3/noderange.3.pod +++ b/xCAT-client/pods/man3/noderange.3.pod @@ -14,6 +14,8 @@ I node[14-56] + f[1-3]n[1-20] + all,-node129-node256,-frame01-frame03 /node.* @@ -48,6 +50,7 @@ A range of nodes or groups: node[01-10] (same as above) node01:node10 (same as above) node[01:10] (same as above) + f[1-2]n[1-3] (equivalent to: f1n1,f1n2,f1n3,f2n1,f2n2,f2n3) group1-group3 (equivalent to: group1,group2,group3) (all the permutations supported above for nodes are also supported for groups) @@ -224,6 +227,12 @@ attribute. nodehm.cons=~hmc +=item 9. + +Generate a list of nodes in the 1st two frames: + + f[1-2]n[1-42] + =back