next up previous contents
Next: Including extra configuration directives Up: How to make a Previous: How to make a   Contents


SPECFORMAT syntax

 SPECFORMAT $<$spec_id$>$ $<$format$>$ [NODE:/// $\vert$ IP:///] [SPEC:///]  


Every POWERCMD directive must reference exactly one spec_id from a SPECFORMAT description. The resulting formats are sent through a POWERCMD command and executed by the pwr script. The same is true for all CONSOLECMD directives.

A SPECFORMAT describes the hostname representation a particular command uses to specify which nodes to operate on. Several formats currently exist which can be used to describe a set of nodes.

Format name Format behavior
hostname The resulting command uses the hostname of each specified node and
  runs one command for each hostname.
ipaddr The resulting command uses the IP address of each specified node and
  runs one command for each IP address.
basic_range One or more node ranges are constructed. Each range is of the form:
  prefix[a-b], where a$<$b. (ie: node[1-32])
ext_range One or more node ranges are constructed. Each range is of the form:
  prefix[a-b,x-y,...], where a$<$b and x$<$y. (ie: node[1-4,10-20,25])

Note: Adding a '+' to the end of any format causes that format to be used multiple times (space seperated) in a single command.

Consider the ipmipower utility as an example, which represents a range of nodes as host[a-b,x-y]. The ext_range format translates a set of hostnames into one or more ranges in the form acceptable to ipmipower.

The hostname and ipaddr formats are both used for commands that operate on a single hostname or IP address. Each hostname or IP address can optionally have a transformation applied to it before applying the given format, by using the NODE:/// or IP:/// options.

Similar to the NODE and IP translations, a final translation can be done on the formatted string before it gets substituted into a command. The SPEC:/// option can define this post-translation, if needed

The NODE:///, IP:///, and SPEC:/// translations can be any perl-style pattern replacement expression. Refer to the perl documentation (man perlop and man perlre) for details on using the s/// operator.

In addition to normal perl syntax, the right-hand-side (replacement) portion of the translation expression can contain minimal inline perl code blocks within {} brackets. These code blocks can be used to replace patterns in the hostname or IP addresses with values computed from evaluating the inline code expression. This is useful for doing inline math on an IP address, when necessary. The {...} code blocks must be kept very simple as they cannot yet contain any spaces.

Note: The -dryrun option to the pwr and consl commands is useful when developing a SPECFORMAT, POWERCMD, and CONSOLECMD directives for an environment. It shows the commands that the current configuration can generate. A working configuration can be arrived upon fairly quickly by iterating through changes in your configuration and using the -dryrun option.


next up previous contents
Next: Including extra configuration directives Up: How to make a Previous: How to make a   Contents
root 2017-02-23