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 the devs list πŸ’–
  • the Master reserves all the devices from that devs list with the reservation --prout-type value that comes from the reservation_type parameter πŸ‘‘

πŸŽ€ 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 $device works (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 than required_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 β€” the master_score_base value is used in the master_score calculation:
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 the master_score calculation ✨. each "working" device gives additional value to master_score, so the node that sees more devices gets preferred for the "Master"-role. setting it to 0 disables this behavior. optional, string, default "100" 🌈
  • master_score_delay β€” this one's the spicy one 🌢️: the master/slave decreases/increases its master_score after a delay of $master_score_delay seconds. so if some device gets inaccessible, the slave decreases its master_score first and the resource will no be watched, and after this device reappears again the master increases its master_score first πŸ’€. this can work only if the master_score_delay is bigger then the monitor interval on both master and slave. setting it to 0 disables 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, unironically UNKNOWN πŸ’€, dated 10/01/2026. iconic of her ngl. slay, stay reserved, and don't @ me πŸŒΈπŸ’…πŸ‘‘
πŸ“¦ where this page comes from