fence_na -a fence_na01.domain.com -n 2 -l admin -p secret -o off
DESCRIPTIONThis 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.
USAGEArguments are read from STDIN 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.
OVERVIEWThis 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.
NODE ASSASSIN PORTSThe FenceAgentAPI refers to ``ports'' while the Node Assassin refers to ``nodes''. These two terms are thus used interchangably. The reason for the difference is that, internally, Node Assassin maps each node to three ``ports''; 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.
NODE ASSASSIN STATESEach Node Assassin port can be set to one of four states. They are:
0This will release the fence on the specified NA node's power and reset ports.
1This state will fence the node specified by the ``port'' argument. The fence will remain active until released. Further, the fence will ``lock out'' the node's front-panel buttons until the fence is released.
2This 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.
3This 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.
OPTIONSWhich options are valid depends on how the arguments are passed in. The ``main'' method of passing arguments is via STDIN 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.
-hPrints this help message.
-v, -VPrints the version of this fence agent and then the version of any configured, reachable Node Assassins.
-qTells this fence agent to only print critical messages.
-dTells this fence agent to print debug messages.
-a address, ipaddr=addressTells the fence agent which Node Assassin to use.
NOTE! The name or IP addresses *MUST* match a name or IP address defined in "/etc/cluster/fence_na.conf"! Specifically, it must match one of the "node::X::ipaddr" entries where "X" is the ID of the Node Assassin.
-l name, login=nameThis is the login name used to connect to this fence agent. It must match the value "system::username" in "/etc/cluster/fence_na.conf".
-p secret, passwd=secretThis is the login password used to connect to this fence agent. It must match the value "system::password" in "/etc/cluster/fence_na.conf".
-n #, port=#This tells the fence agent which node to act on.
NOTE! Please do not confuse this with the Node Assassin's internal concept of a port.
-o val, action=valThis is the "action" (formerly "option") 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 ``state 2'').
Note: This will do a hard reboot! Do not use when a normal restart would suffice.
This essetially just calls an "off" and then an "on". However, the fence_na agent will return a success (exit 0) even if the "on" 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 "STDOUT".
Node Assassin Specific ActionsNOTE: The following states are supported by Node Assassin only. These states are not used by the "fenced" daemon and are provided here as a convenience for the user.
Any commands named *_all ignore the node value, if set.
releaseIf the node is fenced, the fence will be released. The difference from "on" being that this will not boot the node after the fence is released.
release_allThis does a "release" on all fenced nodes.
fence_allAll nodes are fenced. See the "off" state above.
bootThe 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.
boot_allThe power feeds of all nodes on the Node Assassin are checked. Any found to be off are set to state 2 to initiate boot.
shutdownThe 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.
shutdown_allThe 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.
forcedown_allThe 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 ""off"" above), except that the node's front-panel switches are not disabled after the fence completes.
EXAMPLESTo simulate how 'fenced' calls the script, create a text file called "args.txt" 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 "cat" to pipe the contents into the fence agent:
cat args.txt | fence_na
This will call the "off" function against node #02 connected to the Node Assassin at "fence_na01.domain.com", fencing it. Change the "action" line to "action=on" 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
UPDATEDNov. 27, 2010
Digimer ([email protected])