diff --git a/doc/FenceAgentAPI.md b/doc/FenceAgentAPI.md index e589a6b6..21956c6a 100644 --- a/doc/FenceAgentAPI.md +++ b/doc/FenceAgentAPI.md @@ -1,206 +1,196 @@ -

This page describes how to implement a fencing agent, and how agents are -called from the cluster software.

-

Fencing, generally, is a way to prevent an ill-behaved cluster member +This page describes how to implement a fencing agent, and how agents are +called from the cluster software. + +Fencing, generally, is a way to prevent an ill-behaved cluster member from accessing shared data in a way which would cause data or file system corruption. The canonical case where fencing is required is something like this: Node1 live-hangs with a lock on a GFS file system. Node2 thinks node1 is dead, takes a lock, and begins accessing the same data. Node1 wakes up and continues what it was doing. Because we can not predict when node1 would wake up or prevent it from issuing I/Os immediately after waking up, we need a way to prevent its I/Os from -completing even if it does wake up.

-

Definitions

- -

What is given to fencing agents by fenced & stonithd

-

When the cluster decides a node must be fenced, a node is chosen to + has been fenced. This is never recommended. + +## What is given to fencing agents by fenced & stonithd + +When the cluster decides a node must be fenced, a node is chosen to perform the task. The fence daemon ("fenced") is responsible for performing the request, and it spawns agents listed for a given node as noted in cluster.conf. When called by other pieces of software (fenced, -fence_node), fencing agents take arguments from standard input (as -opposed to the command line) in the following format:

-
argument=value
-#this line is ignored
-argument2=value2
-
- - - -

The following things are not allowed in this input:

- -

The following are guidelines for parsing the arguments:

- -

Example cluster.conf

-
<clusternodes>
-    <clusternode name="red.lab.boston.redhat.com" nodeid="1" votes="1">
-        <fence>
-            <method name="1">
-                <device name="ips-rack9" port="1" action="reboot"/>
-            </method>
-        </fence>
-    </clusternode>
-    ...
-</clusternodes>
-<fencedevices>
-    <fencedevice agent="fence_wti" name="ips-rack9" passwd="wti" ipaddr="ips-rack9"/>
-</fencedevices>
-
- - -

Example input given to a fence_agent

-

Given the previous cluster.conf example, the following is sent to the -agent named fence_wti when the cluster decides to fence -red.lab.boston.redhat.com:

-
agent=fence_wti
-name=ips-rack9
-passwd=wti
-ipaddr=ips-rack9
-port=1
-action=reboot
-nodename=red.lab.boston.redhat.com
-
- - -

Note that fenced always passes the name of the node to be fenced via the -nodename argument.

-

Agent Operations and Return Values

- -

Attribute Specifications

-

These attributes should be used when implementing new agents, but this + Return values: + - 0 if the fence device is reachable and working properly + - 1 if the fence device could not be contacted + - 2 if the fence device is reachable but is in the *off* state + (single-port hardware only) +- *list* - Multi-port fencing devices only. Prints a list of port + names and assignments Return values: + - 0 if the fence device is reachable and working properly + - 1 if the fence device could not be contacted + +## Attribute Specifications + +These attributes *should* be used when implementing new agents, but this is not an exhaustive list. Some agents may have other arguments which -are not covered here.

- -

Implementation Best-Practices

-

Currently, this project has a number of requirements which should be -common to all agents (even if not currently):

- + implementation dependent. +- Output of **fence\_agent -o metadata** should validate against + RelaxNG schema available at [lib/metadata.rng](https://raw.githubusercontent.com/ClusterLabs/fence-agents/master/lib/metadata.rng)