| 1 |
EXTERNAL module for Linux-HA STONITH |
| 2 |
|
| 3 |
|
| 4 |
This stonith plugin runs an external command written in your favorite |
| 5 |
language to shutdown the given host. The external command should return |
| 6 |
a zero exit status after a successful shutdown, or non-zero exit status |
| 7 |
for a shutdown failure. Failures notifications will be sent to syslog. |
| 8 |
|
| 9 |
To create your own external plugin, write a script that supports the |
| 10 |
following actions: |
| 11 |
|
| 12 |
reset |
| 13 |
on (optional) |
| 14 |
off (optional) |
| 15 |
gethosts |
| 16 |
status |
| 17 |
getconfignames |
| 18 |
getinfo-devid |
| 19 |
getinfo-devname |
| 20 |
getinfo-devdescr |
| 21 |
getinfo-devurl |
| 22 |
getinfo-xml |
| 23 |
|
| 24 |
and place it in the /usr/lib/stonith/plugins/external directory - the |
| 25 |
script must be a regular executable file that is NOT writable by group |
| 26 |
or others in order to be recognized as an external plugin. If the |
| 27 |
action requires information to be returned, such as the list of hosts |
| 28 |
or config names or any of the getinfo calls, simply write the |
| 29 |
information to stdout. When complete, return zero to indicate the |
| 30 |
action succeeded or non-zero to indicate the action failed. You can |
| 31 |
use the ssh (sh) and riloe (pyhton) scripts already in that directory |
| 32 |
as working examples. |
| 33 |
|
| 34 |
To make sure that your external plugin is recognized, run "stonith -L" |
| 35 |
and look for its name in the output, something along the lines of: |
| 36 |
|
| 37 |
external/yourplugin |
| 38 |
|
| 39 |
To configure the plugin on an R1 (legacy) cluster, add a line similar |
| 40 |
to the following to /etc/ha.d/ha.cf: |
| 41 |
|
| 42 |
stonith external/yourplugin /etc/ha.d/yourplugin.cfg |
| 43 |
|
| 44 |
where /etc/ha.d/yourplugin.cfg contains a single line with all of your |
| 45 |
plugin's parameters: |
| 46 |
|
| 47 |
parm1-value parm2-value ... |
| 48 |
|
| 49 |
Another way to configure the plugin on a legacy cluster is to add a line |
| 50 |
similiar to the following to /etc/ha.d/ha.cf instead: |
| 51 |
|
| 52 |
stonith_host * external/yourplugin parm1-value parm2-value ... |
| 53 |
|
| 54 |
where all of your plugin's parameters are placed at the end of the line. |
| 55 |
|
| 56 |
Please note that all parameters come in to the plugin in name/value |
| 57 |
(environment variable) form, but in R1 configurations, they appear as a |
| 58 |
list of parameters. They are ordered in the config file or on the |
| 59 |
stonith_host line according to the ordering specified in the output of |
| 60 |
the getconfignames operation. |
| 61 |
|
| 62 |
To configure the plugin on an R2 cluster, place lines similar to the |
| 63 |
following into the <resources> section of your CIB, which is contained |
| 64 |
in /var/lib/heartbeat/crm/cib.xml: |
| 65 |
|
| 66 |
<clone id="DoFencing"> |
| 67 |
<instance_attributes> |
| 68 |
<nvpair name="clone_max" value="2"/> |
| 69 |
<nvpair name="clone_node_max" value="1"/> |
| 70 |
</instance_attributes> |
| 71 |
<primitive id="child_DoFencing" class="stonith" type="external/yourplugin" provider="heartbeat"> |
| 72 |
<operations> |
| 73 |
<op name="monitor" interval="5s" timeout="20s" requires="nothing"/> |
| 74 |
<op name="start" timeout="20s" requires="nothing"/> |
| 75 |
</operations> |
| 76 |
<instance_attributes> |
| 77 |
<nvpair name="parm1-name" value="parm1-value"/> |
| 78 |
<nvpair name="parm2-name" value="parm2-value"/> |
| 79 |
<!-- ... --> |
| 80 |
</instance_attributes> |
| 81 |
</primitive> |
| 82 |
</clone> |
| 83 |
|
| 84 |
Whatever <nvpair> parameters specified in the <attributes> section of |
| 85 |
the CIB are passed to the script as environment variables. For the |
| 86 |
example above, the parameters are passed as parm1-name=parm1-value, |
| 87 |
parm2-name=parm2-value and so on. |
| 88 |
|
| 89 |
Additional information can be found at |
| 90 |
http://linux-ha.org/wiki/ExternalStonithPlugins. |