diff --git a/extra/resources/ifspeed.in b/extra/resources/ifspeed.in index c435891952..4f3c334125 100755 --- a/extra/resources/ifspeed.in +++ b/extra/resources/ifspeed.in @@ -1,554 +1,551 @@ #!@BASH_PATH@ # # ocf:pacemaker:ifspeed resource agent # -# Copyright 2011-2021 the Pacemaker project contributors +# Copyright 2011-2022 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # # -# OCF resource agent which monitors state of network interface and records it -# as a node attribute in the CIB based on the sum of speeds of its active (up, -# link detected, not blocked) underlying interfaces. +# Record speed of a network interface as a node attribute, based on the sum of +# speeds of its active (up, link detected, not blocked) underlying interfaces. # -# Partially based on 'ping' RA by Andrew Beekhof +# Originally based on ocf:pacemaker:ping agent # -# Change on 2017 by Tomer Azran : -# Add "ip" parameter to detect network interface name by ip address: -# http://lists.clusterlabs.org/pipermail/users/2017-August/006224.html -# -# OCF instance parameters: -# OCF_RESKEY_name: name of attribute to set in CIB -# OCF_RESKEY_ip ip address to check -# OCF_RESKEY_iface: network interface to monitor -# OCF_RESKEY_bridge_ports: if not null and OCF_RESKEY_iface is a bridge, list of -# bridge ports to consider. -# Default is all ports which have designated_bridge=root_id -# OCF_RESKEY_weight_base: Relative weight of 1Gbps. This can be used to tune -# value of resulting CIB attribute. -# -# Initialization: : ${OCF_FUNCTIONS:="${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs"} # If these aren't available, we can still show help, # which is all that is needed to build the man pages. [ -r "${OCF_FUNCTIONS}" ] && . "${OCF_FUNCTIONS}" [ -r "${OCF_FUNCTIONS_DIR}/findif.sh" ] && . "${OCF_FUNCTIONS_DIR}/findif.sh" : ${OCF_SUCCESS:=0} : ${__OCF_ACTION:=$1} FINDIF=findif # Defaults OCF_RESKEY_name_default="ifspeed" OCF_RESKEY_bridge_ports_default="detect" OCF_RESKEY_weight_base_default=1000 OCF_RESKEY_dampen_default=5 # Explicitly list all environment variables used, to make static analysis happy : ${OCF_RESKEY_name:=${OCF_RESKEY_name_default}} : ${OCF_RESKEY_bridge_ports:=${OCF_RESKEY_bridge_ports_default}} : ${OCF_RESKEY_weight_base:=${OCF_RESKEY_weight_base_default}} : ${OCF_RESKEY_dampen:=${OCF_RESKEY_dampen_default}} : ${OCF_RESKEY_iface:=""} : ${OCF_RESKEY_ip:=""} : ${OCF_RESKEY_debug:="false"} - meta_data() { cat < - -1.0 + +1.1 -Every time the monitor action is run, this resource agent records (in the CIB) -(relative) speed of network interface it monitors. +This agent's monitor action records the speed of a specified network interface +as a node attribute. The attribute can be used in rules to prefer nodes based +on network speeds. -This RA can monitor physical interfaces, bonds, bridges, vlans and (hopefully) -any combination of them. +This agent can monitor physical interfaces, bonded interfaces, bridges, VLANs, +or any combination thereof. For example: -Examples: *) Bridge on top of one 10Gbps interface (eth2) and 802.3ad bonding (bond0) built on two 1Gbps interfaces (eth0 and eth1). -*) Active-backup bonding built on top of one physical interface and one vlan on +*) Active-backup bonding built on top of one physical interface and one VLAN on another interface. -For STP-enabled bridges this RA tries to some-how guess network topology and by -default looks only on ports which are connected to upstream switch. This can be -overridden by 'bridge_ports' parameter. Active interfaces in this case are those -in "forwarding" state. +For STP-enabled bridges, this agent tries to determine the network topology, and +by default looks only on ports which are connected to an upstream switch. This +can be overridden by 'bridge_ports' parameter. Active interfaces in this case +are those in "forwarding" state. -For balancing bonds this RA summs speeds of underlying "up" slave interfaces -(and applies coefficient 0.8 to result). +For balancing bonded interfaces, this agent uses 80% of the sum of the speeds of +underlying "up" ports. -For non-balancing bonds ('active-backup' and probably 'broadcast'), only the -speed of the currently active slave is used. +For non-balancing bonded interfaces ("active-backup" and probably "broadcast"), +only the speed of the currently active port is considered. Network interface speed monitor - + -The name of the attribute to set. This is the name to be used in the constraints. +Name of the node attribute to set Attribute name - + -Network interface to monitor. +If this is set, monitor this network interface. One of iface or ip must be set. Network interface - + -Try to detect interface name by detecting the interface that holds the IP address. -The IPv4 (dotted quad notation) or IPv6 address (colon hexadecimal notation) -example IPv4 "192.168.1.1". -example IPv6 "2001:db8:DC28:0:0:FC57:D4C8:1FFF". +If this is set instead of iface, monitor the interface that holds this IP +address. The address may be specified in dotted-quad notation for IPv4 (for +example, 192.168.1.1) or hexadecimal notation for IPv6 (for example, +2001:db8:DC28:0:0:FC57:D4C8:1FFF). One of iface or ip must be set. IPv4 or IPv6 address - + -If not null and OCF_RESKEY_iface is a bridge, list of bridge ports to consider. -Default is all ports which have designated_bridge=root_id. +If set and iface is a bridge, consider these bridge ports (by default, all ports +which have designated_bridge=root_id) Bridge ports - + Relative weight of 1Gbps in interface speed. Can be used to tune how big attribute value will be. Weight of 1Gbps - + The time to wait (dampening) for further changes to occur. Dampening interval - + -Log what have been done more verbosely. +Log more verbosely. Verbose logging END } usage() { cat <