Every POWERCMD and CONSOLECMD 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.
A SPECFORMAT describes the format 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.
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![]() |
|
ext_range | One or more node ranges are constructed. Each range is of the form: |
prefix[a-b,x-y,...], where a![]() ![]() |
|
Note: | Adding a '+' to the end of any format causes that format |
to be used multiple times in a single command. |
Consider the powerman 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 powerman.
Formats useful for other utilities can be derived from an
existing format and a `SPEC:///' translation if needed. The
number of
formats will never become excessive because the number of ways to represent a set of hosts is limited.
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:///'
parameters.
The `SPEC:///', `NODE:///', and `IP:///'
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.
Similar to the NODE and IP translations, a final translation can
be done on the formatted spec before it gets used in a pwr
command. Including
a `SPEC:///' parameter will define the desired translation.
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.