OCF_HEARTBEAT_SG_PER(7)
π OCF_HEARTBEAT_SG_PER(7) π
okay bestie, sit down, because today we're talking about ocf_heartbeat_sg_persist β yes, that's the whole OCF_HEARTBEAT_SG_PER(7) girlie you keep seeing in the man pages β and she manages SCSI PERSISTENT RESERVATIONS. no cap.
β¨ NAME β¨
ocf_heartbeat_sg_persist β literally just out here managing SCSI PERSISTENT RESERVATIONS π«Ά
πΈ SYNOPSIS πΈ
sg_persist [start | stop | monitor | promote | demote | meta-data |
validate-all]
π¦ DESCRIPTION π¦
so this resource agent is the main character for SCSI PERSISTENT RESERVATIONS, and it does it with sg_persist from sg3_utils β go read its documentation too, iykyk π₯.
the vibe is multistate (Master/Slave), periodt:
- the Slave registers its node id (from
crm_node -i) as the reservation key (--param-rk) on every single device in thedevslist π - the Master reserves all the devices from that
devslist with the reservation--prout-typevalue that comes from thereservation_typeparameter π
π SUPPORTED PARAMETERS π
binaryβ the name of the binary that manages the resource. she's optional, a string, and defaults to"sg_persist"β¨devsβ the Device list! π¦ you can list multiple devices with a blank space as the separator, and shell wildcards are allowed. this one is required, a string, and has no default β not me warning you πrequired_devs_nofβ the minimum number of "working" devices from the device list, where a "working" device is 1) existing and 2)sg_persist --read-keys $deviceworks (Return code 0) π. the resource actions"start","monitor","promote"and"validate-all"return"$OCF_ERR_INSTALLED"if the actual number of "working" devices is less thanrequired_devs_nof. meanwhile"stop"and"demote"try to remove reservations and registration keys from all working devices, but always return"$OCF_SUCCESS". optional, string, default"1"π«Άreservation_typeβ reservation type. that's it, that's the whole job. optional, string, default"1"πmaster_score_baseβ themaster_score_basevalue is used in themaster_scorecalculation:
master_score = $master_score_base + $master_score_dev_factor * $working_devs
so if you set it to a bigger value in the sg_persist resource configuration on some node, that node becomes the "preferred" one for the master role π. optional, string, default "0" β
master_score_dev_factorβ the working device factor in themaster_scorecalculation β¨. each "working" device gives additional value tomaster_score, so the node that sees more devices gets preferred for the "Master"-role. setting it to0disables this behavior. optional, string, default"100"πmaster_score_delayβ this one's the spicy one πΆοΈ: the master/slave decreases/increases itsmaster_scoreafter a delay of$master_score_delayseconds. so if some device gets inaccessible, the slave decreases itsmaster_scorefirst and the resource will no be watched, and after this device reappears again the master increases itsmaster_scorefirst π. this can work only if themaster_score_delayis bigger then the monitor interval on both master and slave. setting it to0disables this behavior. optional, string, default"30"π§
π SUPPORTED ACTIONS π
this resource agent supports the following actions (operations), and yes we're going through all of them, no skipping π₯:
startβ Starts the resource. Suggested minimum timeout:30s. πΈpromoteβ Promotes the resource to the Master role. Suggested minimum timeout:30s. πdemoteβ Demotes the resource to the Slave role. Suggested minimum timeout:30s. πnotifyβ Suggested minimum timeout:30s. π¦stopβ Stops the resource. Suggested minimum timeout:30s. β¨monitor(Unpromoted role) β Performs a detailed status check. Suggested minimum timeout:20s. Suggested interval:29s. πmonitor(Promoted role) β Performs a detailed status check. Suggested minimum timeout:20s. Suggested interval:60s. βmeta-dataβ Retrieves resource agent metadata (internal use only). Suggested minimum timeout:5s. πvalidate-allβ Performs a validation of the resource configuration. Suggested minimum timeout:30s. π«Ά
π§ EXAMPLE CRM SHELL π§
here's an example configuration for a sg_persist resource using the crm(8) shell, copy it, don't fight it π
:
primitive p_sg_persist ocf:heartbeat:sg_persist \
params \
devs=string \
op monitor depth="0" timeout="20s" interval="29s" role="Unpromoted" \
op monitor depth="0" timeout="20s" interval="60s" role="Promoted"
ms ms_sg_persist p_sg_persist \
meta notify="true" interleave="true"
π EXAMPLE PCS π
and here's the same vibe for a sg_persist resource using pcs(8) π¦:
pcs resource create p_sg_persist ocf:heartbeat:sg_persist \
devs=string \
op monitor OCF_CHECK_LEVEL="0" timeout="20s" interval="29s" role="Unpromoted" \
op monitor OCF_CHECK_LEVEL="0" timeout="20s" interval="60s" role="Promoted" promotable
π SEE ALSO π
π AUTHOR π
ClusterLabs contributors (see the resource agent source for information about individual authors) π«Ά
bestie real talk: this page is from resource-agents and the version is literally, unironicallyUNKNOWNπ, dated10/01/2026. iconic of her ngl. slay, stay reserved, and don't @ me πΈπ π
π¦ where this page comes from
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms