Fence_na this is the fence agent for the node assassin fence device.
fence_na -a fence_na01.domain.com -n 2 -l admin -p secret -o off
This fence agent takes argument from the command line or from the 'fenced' program and interprets them into calls to send to the Node Assassin fence device. It analyzes the returned information and exits with an appropriate exit code as dictated by the FenceAgentAPI.
Arguments are read from \s-1STDIN\s0 as 'variable=value' pairs, one pair per new line. This is the method used by 'fenced'.
For testing or manual control, arguments may be passed as command line arguments.
This takes arguments that defined which Node Assassin to call, what node to work on and what action should be taken. These arguments are defined by the FenceAgentAPI. These actions are then translated into a set of Node Assassin states which then get passed to the device. The FenceAgentAPI refers to \*(L"ports\*(R" while the Node Assassin refers to \*(L"nodes\*(R". These two terms are thus used interchangably. The reason for the difference is that, internally, Node Assassin maps each node to three \*(L"ports\*(R"; The node's power and reset buttons plus the node's power feed.
Each node in the Node Assassin can be set to one of four states described in the next section.
Each Node Assassin port can be set to one of four states. They are: This will release the fence on the specified \s-1NA\s0 node's power and reset ports. This state will fence the node specified by the \*(L"port\*(R" argument. The fence will remain active until released. Further, the fence will \*(L"lock out\*(R" the node's front-panel buttons until the fence is released. This will fence the node for one second. This is meant to provide a mechanism to boot or initiate a clean shut down of a node. This state will fence the node for five seconds to 30 seconds, depending on how long it takes for the power feed to drop low. This is meant to provide a way to force crashed nodes to power off without the front-panel lock.
Which options are valid depends on how the arguments are passed in. The \*(L"main\*(R" method of passing arguments is via \s-1STDIN\s0 as a series of 'varible=value' pairs, one per line. All arguments accepted this way have command-line arguments passed in via single-dashes switches. Each option below shows either calling method's arguments, where available. Prints this help message. Prints the version of this fence agent and then the version of any configured, reachable Node Assassins. Tells this fence agent to only print critical messages. Tells this fence agent to print debug messages. Tells the fence agent which Node Assassin to use.
\s-1NOTE\s0! The name or \s-1IP\s0 addresses *MUST* match a name or \s-1IP\s0 address defined in \*(C`/etc/cluster/fence_na.conf\*(C'! Specifically, it must match one of the \*(C`node::X::ipaddr\*(C' entries where \*(C`X\*(C' is the \s-1ID\s0 of the Node Assassin. This is the login name used to connect to this fence agent. It must match the value \*(C`system::username\*(C' in \*(C`/etc/cluster/fence_na.conf\*(C'. This is the login password used to connect to this fence agent. It must match the value \*(C`system::password\*(C' in \*(C`/etc/cluster/fence_na.conf\*(C'. This tells the fence agent which node to act on.
\s-1NOTE\s0! Please do not confuse this with the Node Assassin's internal concept of a port. This is the \*(C`action\*(C' (formerly \*(C`option\*(C') to perform on the selected node. Valid actions and how Node Assassin implements them are:
This set's the node to state 1; Fenced. Internally, it will hit the reset switch for one second to immediately disable the node. Then it will release the reset switch for another second before pressing and holding the power switch. After five seconds, Node Assassin will check the node's power feed. If it is still on, it will wait another 25 seconds and check again. If the node is still on, an error will be generated. If the node turns off successfully, the fence is declared a success. reboot
This sets the node to state '0'; Unfenced. Both the power and reset switches are opened, the Node Assassin will pause for one second and then the power switch will be closed for one second to boot the node (that is, the node is set to \*(L"state 2\*(R").
Note: This will do a hard reboot! Do not use when a normal restart would suffice.
This essetially just calls an \*(C`off\*(C' and then an \*(C`on\*(C'. However, the fence_na agent will return a success (exit 0) even if the \*(C`on\*(C' stage succeeded. As per the FenceAgentAPI, a reboot does not need to successfully boot the node to be concidered a success, it only needs to shut it down.
This checks the power feed for the requested node is checked. If the node is on, the agent will exit with code 0. If the node is off (or disconnected), it will exit with code 1. If an error occurred calling the Node Assassin, this will exit with code 2.
Note that this argument is designed to be used by the fence agent and will not print any output to \*(C`STDOUT\*(C'.
\s-1NOTE\s0: The following states are supported by Node Assassin only. These states are not used by the \*(C`fenced\*(C' daemon and are provided here as a convenience for the user.
Any commands named *_all ignore the node value, if set. If the node is fenced, the fence will be released. The difference from \*(C`on\*(C' being that this will not boot the node after the fence is released. This does a \*(C`release\*(C' on all fenced nodes. All nodes are fenced. See the \*(C`off\*(C' state above. The power feed of the specific node on the Node Assassin is checked. If it is found to be off, it will be set to state 2 to initiate boot. The power feeds of all nodes on the Node Assassin are checked. Any found to be off are set to state 2 to initiate boot. The power feed of the specific node on the Node Assassin is checked. If it is found to be on, it will be set to state 2 to initiate an ACPI-induced soft shutdown. The power feeds of all nodes on the Node Assassin are checked. Any found to be on are set to state 2 to initiate an ACPI-induced soft shutdown. The power feeds of all nodes on the Node Assassin are checked. Any found to be on are set to state 3. This state is similar to state 1 (see "\*(C`off\*(C'" above), except that the node's front-panel switches are not disabled after the fence completes.
To simulate how 'fenced' calls the script, create a text file called \*(C`args.txt\*(C' containing:
# Test file used as input for the NA fence agent. ipaddr=fence_na01.domain.com port=02 login=admin passwd=secret action=reboot
Now use \*(C`cat\*(C' to pipe the contents into the fence agent:
cat args.txt | fence_na
This will call the \*(C`off\*(C' function against node #02 connected to the Node Assassin at \*(C`fence_na01.domain.com\*(C', fencing it. Change the \*(C`action\*(C' line to \*(C`action=on\*(C' and re-run the script to release the fence and boot the node.
To duplicate the same call using command line arguments:
fence_na -a fence_na01.domain.com -n 2 -l admin -p secret -o reboot
Nov. 27, 2010
Digimer ([email protected])