Skip to content

Commit

Permalink
Merge pull request #271 from fmherschel/angi-devel
Browse files Browse the repository at this point in the history
angi: saphana-common-lib: bsc#1233972 - hostnames might contain dashes
  • Loading branch information
fmherschel authored Dec 2, 2024
2 parents 4b9cfe0 + a74634e commit 72c98d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions ra/saphana-common-lib
Original file line number Diff line number Diff line change
Expand Up @@ -676,13 +676,13 @@ function get_local_sr_config() {
function get_local_virtual_name() {
# called by: TODO
local -a listInstances
local lI lIh1
local lI
if [ -e /usr/sap/hostctrl/exe/saphostctrl ]; then
mapfile -t listInstances < <( /usr/sap/hostctrl/exe/saphostctrl -function ListInstances )
for lI in "${listInstances[@]}"; do
lIh1="${lI// /}"
# InstInfo:HA1-00-suse01-753,patch1010,changelist2124070
if [[ "$lIh1" =~ :"$SID"-"$InstanceNr"-([^-]*)- ]]; then
# InstInfo : HA1 - 00 - suse-01 - 753,patch1010,changelist2124070
# bsc#1233972 - hostname may include dashes
if [[ "$lI" =~ "$SID - $InstanceNr - "([^ ]*)" -" ]]; then
gVirtName="${BASH_REMATCH[1]}"
break
fi
Expand Down
15 changes: 8 additions & 7 deletions ra/saphana-topology-lib
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ function sht_start() {
local hanalrc=0
#local loopcount=0

# TODO: PRIO3: move the string "$HA_RSCTMP/SAPHana/SAPTopologyON" to a variable
# TODO: PRIO3: move the file to the clusters tmp directory?
# TODO PRIO3: move the string "$HA_RSCTMP/SAPHana/SAPTopologyON" to a variable
# TODO PRIO3: move the file to the clusters tmp directory?
mkdir -p "$HA_RSCTMP/SAPHana"
touch "$HA_RSCTMP/SAPHana/SAPTopologyON.${SID}"
if ! check_saphostagent; then
Expand All @@ -286,13 +286,13 @@ function sht_start() {
if [[ "$hanalrc" -lt 124 ]]; then
set_hana_attribute "${NODENAME}" "$gNodeRole" "${ATTR_NAME_HANA_ROLES[@]}"
fi
# TODO PRIO 1: scale-out used side-effect via RC_hdbnsutil to give back different return codes; scale-up rc was always OCF_SUCCESS
# TODO PRIO1: scale-out used side-effect via RC_hdbnsutil to give back different return codes; scale-up rc was always OCF_SUCCESS
# currently using the always-good mode to force OCF_SUCCESS
RC_hdbnsutil=0
case "$RC_hdbnsutil" in
0 | 1 ) rc="$OCF_SUCCESS";; # TODO: Prio 3: Need to check rc==1 - is that success or not_running?
0 | 1 ) rc="$OCF_SUCCESS";; # TODO PRIO3: Need to check rc==1 - is that success or not_running?
2 ) rc="$OCF_NOT_RUNNING";; # rc==2 have been seen for bad persistency layer
* ) rc="$OCF_SUCCESS";; # TODO: Prio 3: Need to check "other" return codes
* ) rc="$OCF_SUCCESS";; # TODO PRIO3: Need to check "other" return codes
esac
# old scale-up code:
# rc=$OCF_SUCCESS
Expand Down Expand Up @@ -329,12 +329,13 @@ function sht_monitor() {
super_ocf_log info "FLOW ${FUNCNAME[0]} ()"
local rc=0
local vName="${NODENAME}"
# TODO PRIO 1: 'node_role_walk' is only needed for scale-out; how to differ that here?
# TODO PRIO1: 'node_role_walk' is only needed for scale-out; how to differ that here?
node_role_walk --standbyFilter=off
# DONE: PRIO1: ASK: Is the output format of ListInstances fix? Could we take that as an API?
# try to catch: Inst Info : LNX - 42 - lv9041 - 740, patch 36, changelist 1444691
# We rely on the following format: SID is word#4, NR is word#6, vHost is word#8
#### SAP-CALL
## TODO PRIO3: align method "ListInstances" with saphana-common-lib
if [ -e /usr/sap/hostctrl/exe/saphostctrl ]; then
vName=$(/usr/sap/hostctrl/exe/saphostctrl -function ListInstances \
| awk '$4 == SID && $6=NR { print $8 }' SID="$SID" NR="$InstanceNr" 2>/dev/null )
Expand Down Expand Up @@ -434,7 +435,7 @@ function sht_stop_clone() {
super_ocf_log info "FLOW ${FUNCNAME[0]} ($*)"
local rc=0 tout=0 nRole nNsConf
hanaPrim="$(check_for_primary "live")";
# TODO: should we simplify the calculation of timeout (see saphana-silesystem-lib)?
# TODO PRIO3: should we simplify the calculation of timeout (see saphana-silesystem-lib)?
# shellcheck disable=SC2154
local actionTimeOut="$OCF_RESKEY_CRM_meta_timeout" stdTimeOut=300 actTimeOutPercent=50
if [ -z "$actionTimeOut" ]; then
Expand Down

0 comments on commit 72c98d2

Please sign in to comment.