Skip to content

Commit

Permalink
galera/mpathpersist/sg_persist/IPsrcaddr: only check notify and promo…
Browse files Browse the repository at this point in the history
…table when OCF_CHECK_LEVEL=10

Pacemaker has started running validate-all action before creating the
resource. It doesnt provide notify/promotable settings while doing so,
so this patch moves these checks to OCF_CHECK_LEVEL 10 and runs the
validate action at OCF_CHECK_LEVEL 10 in the start-action.
  • Loading branch information
oalbrigt committed Jan 3, 2023
1 parent ca009ab commit bf89ad0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
13 changes: 8 additions & 5 deletions heartbeat/IPsrcaddr
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,13 @@ srca_validate_all() {
fi

# We should serve this IP address of course
if ip_status "$ipaddress"; then
:
else
ocf_exit_reason "We are not serving [$ipaddress], hence can not make it a preferred source address"
return $OCF_ERR_INSTALLED
if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then
if ip_status "$ipaddress"; then
:
else
ocf_exit_reason "We are not serving [$ipaddress], hence can not make it a preferred source address"
return $OCF_ERR_INSTALLED
fi
fi
return $OCF_SUCCESS
}
Expand All @@ -540,6 +542,7 @@ esac

ipaddress="$OCF_RESKEY_ipaddress"

[ "$__OCF_ACTION" != "validate-all" ] && OCF_CHECK_LEVEL=10
srca_validate_all
rc=$?
if [ $rc -ne $OCF_SUCCESS ]; then
Expand Down
9 changes: 6 additions & 3 deletions heartbeat/galera.in
Original file line number Diff line number Diff line change
Expand Up @@ -1015,9 +1015,11 @@ galera_stop()

galera_validate()
{
if ! ocf_is_ms; then
ocf_exit_reason "Galera must be configured as a multistate Master/Slave resource."
return $OCF_ERR_CONFIGURED
if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then
if ! ocf_is_ms; then
ocf_exit_reason "Galera must be configured as a multistate Master/Slave resource."
return $OCF_ERR_CONFIGURED
fi
fi

if [ -z "$OCF_RESKEY_wsrep_cluster_address" ]; then
Expand All @@ -1035,6 +1037,7 @@ case "$1" in
exit $OCF_SUCCESS;;
esac

[ "$__OCF_ACTION" = "start" ] && OCF_CHECK_LEVEL=10
galera_validate
rc=$?
LSB_STATUS_STOPPED=3
Expand Down
13 changes: 9 additions & 4 deletions heartbeat/mpathpersist.in
Original file line number Diff line number Diff line change
Expand Up @@ -630,10 +630,11 @@ mpathpersist_action_notify() {
}

mpathpersist_action_validate_all () {

if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE" != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then
ocf_log err "Master options misconfigured."
exit $OCF_ERR_CONFIGURED
if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then
if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE" != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then
ocf_log err "Master options misconfigured."
exit $OCF_ERR_CONFIGURED
fi
fi

return $OCF_SUCCESS
Expand All @@ -659,6 +660,10 @@ case $ACTION in
start|promote|monitor|stop|demote)
ocf_log debug "$RESOURCE: starting action \"$ACTION\""
mpathpersist_init
if [ "$__OCF_ACTION" = "start" ]; then
OCF_CHECK_LEVEL=10
mpathpersist_action_validate_all
fi
mpathpersist_action_$ACTION
exit $?
;;
Expand Down
13 changes: 9 additions & 4 deletions heartbeat/sg_persist.in
Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,11 @@ sg_persist_action_notify() {
}

sg_persist_action_validate_all () {

if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE" != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then
ocf_log err "Master options misconfigured."
exit $OCF_ERR_CONFIGURED
if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then
if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE" != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then
ocf_log err "Master options misconfigured."
exit $OCF_ERR_CONFIGURED
fi
fi

return $OCF_SUCCESS
Expand All @@ -672,6 +673,10 @@ case $ACTION in
start|promote|monitor|stop|demote)
ocf_log debug "$RESOURCE: starting action \"$ACTION\""
sg_persist_init
if [ "$__OCF_ACTION" = "start" ]; then
OCF_CHECK_LEVEL=10
sg_persist_action_validate_all
fi
sg_persist_action_$ACTION
exit $?
;;
Expand Down

0 comments on commit bf89ad0

Please sign in to comment.