diff --git a/README.md b/README.md index d03589cf..d9fcb94b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,18 @@ -Fence agents -============ +# Fence agents + Fence agents were developed as device "drivers" which are able to prevent computers from destroying data on shared storage. Their aim is to isolate a corrupted computer, using one of three methods: * Power - A computer that is switched off cannot corrupt data, but it is important to not do a "soft-reboot" as we won't know if this is possible. This also works for virtual machines when the fence device is a hypervisor. * Network - Switches can prevent routing to a given computer, so even if a computer is powered on it won't be able to harm the data. * Configuration - Fibre-channel switches or SCSI devices allow us to limit who can write to managed disks. Fence agents do not use configuration files, as configuration management is outside of their scope. All of the configuration has to be specified either as command-line arguments or lines of standard input (see the complete list for more info). Because many fence agents are quite similar to each other, a fencing library (in Python) was developed. Please use it for further development. Creating or modifying a new fence agent should be quite simple using this library. -Detailed user and developer documentation can be found here: [https://docs.pagure.org/ClusterLabs.fence-agents/FenceAgentAPI.md](https://docs.pagure.org/ClusterLabs.fence-agents/FenceAgentAPI.md) +## Where can I find more information? + +* [ClusterLabs website](http://www.clusterlabs.org/) +* [User and developer documentation](https://github.com/ClusterLabs/fence-agents/tree/master/doc/FenceAgentAPI.md) +* Mailing lists for [users](http://oss.clusterlabs.org/mailman/listinfo/users) and [developers](http://oss.clusterlabs.org/mailman/listinfo/developers) +* #clusterlabs IRC channel on [freenode](http://freenode.net/) diff --git a/doc/FenceAgentAPI.md b/doc/FenceAgentAPI.md new file mode 100644 index 00000000..e589a6b6 --- /dev/null +++ b/doc/FenceAgentAPI.md @@ -0,0 +1,206 @@ +

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 +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 +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):

+