Skip to content

Commit

Permalink
Merge pull request #157 from fmherschel/bsc1205535-set_SRHOOK_PRIM
Browse files Browse the repository at this point in the history
SAPHana: set_SRHOOK_PRIM
  • Loading branch information
fmherschel authored Dec 5, 2022
2 parents 50259eb + 488f7aa commit cfa8ea8
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions ra/SAPHana
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,26 @@ function set_SRHOOK()
return 0
}

#
# function set_SRHOOK_PRIM - sets the site specific Hook SR status
# params: site-name, value
# globals: ATTR_NAME_HANA_SRHOOK[@](r), ATTR_NAME_HANA_SYNC_STATUS[@](r)
# locals: ATTR[@], my_sync, get_sr_name
# SAPHanaSR Scale-Up already uses multi-target aware SR Hook attribute there is not global fallback attribute
#
function set_SRHOOK_PRIM()
{
local lastSrHook
local lastRemSrHook
# to be backward compatible only set the site attribute, if the local or remote site attribute is already used (set) in the past
lastSrHook=$(get_SRHOOK_plain "$sr_name")
lastRemSrHook=$(get_SRHOOK_plain "$remSR_name")
if [ -n "${lastSrHook}${lastRemSrHook}" ]; then
# reset srHook attribute to PRIM as we found either local or remore srHook attribute
set_SRHOOK "$sr_name" "PRIM"
fi
}

#
# function: saphana_init - initialize variables for the resource agent
# params: InstanceName
Expand Down Expand Up @@ -2475,6 +2495,7 @@ function saphana_monitor_primary()
else
rc=$OCF_SUCCESS
fi
set_SRHOOK_PRIM
my_role=$(get_hana_attribute "${NODENAME}" "${ATTR_NAME_HANA_ROLES[@]}")
super_ocf_log info "DEC: saphana_monitor_primary: scoring_crm_master($my_role,$my_sync)"
scoring_crm_master "$my_role" "$my_sync"
Expand Down Expand Up @@ -2817,14 +2838,8 @@ function saphana_promote_clone() {
rc="$OCF_SUCCESS";
fi
fi
local lastSrHook
if [ $rc -eq $OCF_SUCCESS ]; then
lastSrHook=$(get_SRHOOK_plain "$sr_name")
if [ -n "$lastSrHook" ]; then
# TODO: Should we do this also, if the attribute is empty? If set, only if non-PRIM
# reset old srHook attribute to PRIM as we are starting right now
set_SRHOOK "$sr_name" "PRIM"
fi
set_SRHOOK_PRIM
fi
super_ocf_log info "FLOW ${FUNCNAME[0]} rc=$rc"
return $rc
Expand Down

0 comments on commit cfa8ea8

Please sign in to comment.