Skip to content
thiell edited this page Mar 4, 2012 · 3 revisions

nodeset

The nodeset command is an useful command provided with ClusterShell that implements most of the NodeSet class features. The nodeset command aims to be user-friendly and can also easily enhance your shell scripts.

Usage help

Usage: nodeset [COMMAND] [OPTIONS] [ns1 [-ixX] ns2|...]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -s GROUPSOURCE, --groupsource=GROUPSOURCE
                        optional groups.conf(5) group source to use

  Commands:
    -c, --count         show number of nodes in nodeset(s)
    -e, --expand        expand nodeset(s) to separate nodes
    -f, --fold          fold nodeset(s) (or separate nodes) into one nodeset
    -l, --list          list node groups (see -s GROUPSOURCE)
    -r, --regroup       fold nodes using node groups (see -s GROUPSOURCE)
    --groupsources      list all configured group sources (see groups.conf(5))

  Operations:
    -x SUB_NODES, --exclude=SUB_NODES
                        exclude specified nodeset
    -i AND_NODES, --intersection=AND_NODES
                        calculate nodesets intersection
    -X XOR_NODES, --xor=XOR_NODES
                        calculate symmetric difference between nodesets

  Options:
    -a, --all           call external node groups support to display all nodes
    --autostep=AUTOSTEP
                        auto step threshold number when folding nodesets
    -d, --debug         output more messages for debugging purpose
    -q, --quiet         be quiet, print essential output only
    -R, --rangeset      switch to RangeSet instead of NodeSet. Useful when
                        working on numerical cluster ranges, eg. 1,5,18-31
    -G, --groupbase     hide group source prefix (always "@groupname")
    -S SEPARATOR, --separator=SEPARATOR
                        separator string to use when expanding nodesets
                        (default: ' ')
    -I SLICE_RANGESET, --slice=SLICE_RANGESET
                        return sliced off result
    --split=MAXSPLIT    split result into a number of subsets

Usage examples

Getting the size

$ nodeset -c nova[0-7,32-159]
136
$ nodeset -c nova[0-7,32-159] nova[160-163]
140

Folding nodesets

$ nodeset -f nova[0-7,32-159] nova[160-163]
nova[0-7,32-163]

Expanding nodeset(s)

$ nodeset -e nova[160-163]
nova160 nova161 nova162 nova163

Excluding nodes from nodeset

$ nodeset -f nova[32-159] -x nova33
nova[32,34-159]

Computing nodesets intersection

$ nodeset -f nova[32-159] -i nova[0-7,20-21,32,156-159]
nova[32,156-159]

Computing nodesets symmetric difference (xor)

$ nodeset -f nova[33-159] --xor nova[32-33,156-159]
nova[32,34-155]

Splitting node sets (--split)

$ nodeset --split=2 -f nova[32-159]
nova[32-95]
nova[96-159]
$ nodeset -c nova[32-95]
64
$ nodeset -c nova[96-159]
64

$ nodeset --split=3 -f nova[32-159]
nova[32-74]
nova[75-117]
nova[118-159]
$ nodeset -c nova[32-74]
43
$ nodeset -c nova[75-117]
43
$ nodeset -c nova[118-159]
42

Slicing node sets (--slice / -I)

$ nodeset -f -I 0 nova[10-14]
nova10
$ nodeset -f -I 1,3-4 nova[10-14]
nova[11,13-14]
$ nodeset -f -I 0-4/2 nova[10-14]
nova[10,12,14]
$ nodeset -f -I 0-4/2 --autostep=2 nova[10-14]
nova[10-14/2]
Clone this wiki locally