Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

angi: saphana-common-lib: bsc#1233972 - hostnames might contain dashes #271

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading