Blame SOURCES/bz1168251-SAPHana-agents_update4.patch

261ad6
diff --git a/heartbeat/SAPHana b/heartbeat/SAPHana
261ad6
index 1913dc3..ed0443b 100644
261ad6
--- a/heartbeat/SAPHana
261ad6
+++ b/heartbeat/SAPHana
261ad6
@@ -48,6 +48,8 @@ HANA_STATE_SECONDARY=1
261ad6
 HANA_STATE_STANDALONE=2
261ad6
 HANA_STATE_DEFECT=3
261ad6
 
261ad6
+debug_attributes=0
261ad6
+
261ad6
 SH=/bin/sh
261ad6
 
261ad6
 #
261ad6
@@ -132,19 +134,19 @@ function saphana_meta_data() {
261ad6
 
261ad6
 
261ad6
 <resource-agent name="SAPHana">
261ad6
-<version>0.149.4</version>
261ad6
+<version>0.149.7</version>
261ad6
 
261ad6
 <shortdesc lang="en">Manages two SAP HANA instances in system replication (SR).</shortdesc>
261ad6
 <longdesc lang="en">
261ad6
 The SAPHanaSR resource agent manages two SAP Hana instances (databases) which are configured
261ad6
-in system replication. This first version is limitted to the scale-up scenario. Scale-Out is
261ad6
+in system replication. This first version is limited to the scale-up scenario. Scale-Out is
261ad6
 not supported in this version.
261ad6
 
261ad6
 Managing the two SAP HANA instances means that the resource agent controls the start/stop of the
261ad6
 instances. In addition the resource agent is able to monitor the SAP HANA databases to check their
261ad6
 availability on landscape host configuration level. For this monitoring the resource agent relies on interfaces
261ad6
 provided by SAP. A third task of the resource agent is to also check the synchronisation status
261ad6
-of the two SAP HANA databases. If the synchronisation is not "SOK", than the cluster avoids to
261ad6
+of the two SAP HANA databases. If the synchronisation is not "SOK", then the cluster avoids to
261ad6
 failover to the secondary side, if the primary fails. This is to improve the data consistency.
261ad6
 
261ad6
 The resource agent uses the following four interfaces provided by SAP:
261ad6
@@ -162,7 +164,7 @@ The resource agent uses the following four interfaces provided by SAP:
261ad6
 
261ad6
 3. hdbnsutil
261ad6
    The interface hdbnsutil is used to check the "topology" of the system replication as well as the current configuration
261ad6
-   (primary/secondary) of a SAP HANA database instance. A second task of the interface is the posibility to run a
261ad6
+   (primary/secondary) of a SAP HANA database instance. A second task of the interface is the possibility to run a
261ad6
    system replication takeover (sr_takeover) or to register a former primary to a newer one (sr_register).
261ad6
 
261ad6
 4. hdbsql / systemReplicationStatus
261ad6
@@ -198,7 +200,7 @@ The resource agent uses the following four interfaces provided by SAP:
261ad6
     </parameter>
261ad6
     <parameter name="AUTOMATED_REGISTER"  unique="0" required="0">
261ad6
         <shortdesc lang="en">Define, if a former primary should automatically be registered.</shortdesc>
261ad6
-        <longdesc lang="en">The parameter AUTOMATED_REGISTER defines, wether a former primary instance should
261ad6
+        <longdesc lang="en">The parameter AUTOMATED_REGISTER defines, whether a former primary instance should
261ad6
              be registered automatically by the resource agent during cluster/resource start, if  the DUPLICATE_PRIMARY_TIMEOUT is expired... TDB
261ad6
         </longdesc>
261ad6
         <content type="boolean" default="false" />
261ad6
@@ -207,7 +209,7 @@ The resource agent uses the following four interfaces provided by SAP:
261ad6
         <shortdesc lang="en">Time difference needed between to primary time stamps, if a dual-primary situation occurs</shortdesc>
261ad6
         <longdesc lang="en">Time difference needed between to primary time stamps, 
261ad6
         if a dual-primary situation occurs. If the time difference is
261ad6
-        less than the time gap, than the cluster hold one or both instances in a "WAITING" status. This is to give a admin
261ad6
+        less than the time gap, then the cluster hold one or both instances in a "WAITING" status. This is to give an admin
261ad6
         a chance to react on a failover. A failed former primary will be registered after the time difference is passed. After
261ad6
         this registration to the new primary all data will be overwritten by the system replication.
261ad6
         </longdesc>
261ad6
@@ -316,7 +318,7 @@ function remoteHost2remoteNode()
261ad6
 # descript: is_clone : find out if we are configured to run in a Master/Slave configuration
261ad6
 # rc: 0: it is a clone, 1: it is not a clone
261ad6
 #
261ad6
-# DONE: PRIO2: For the first shippment (scale-out) we need to limit the clones to 2
261ad6
+# DONE: PRIO2: For the first shipment (scale-out) we need to limit the clones to 2
261ad6
 #
261ad6
 function is_clone() {
261ad6
     super_ocf_log info "FLOW $FUNCNAME ($*)"
261ad6
@@ -356,8 +358,14 @@ function get_hana_attribute()
261ad6
     local attr_node=$1
261ad6
     local attr_name=$2
261ad6
     local attr_store=${3:-reboot} # DONE: PRIO5 get this (optional) from parameter
261ad6
-    local attr_default=${4:-}
261ad6
-    crm_attribute -N ${attr_node} -G -n "$attr_name" -l $attr_store -q -d "$attr_default"; rc=$?
261ad6
+    local attr_default=${5:-}
261ad6
+    local attr_val=""
261ad6
+    attr_val=$(crm_attribute -N ${attr_node} -G -n "$attr_name" -l $attr_store -q -d "$attr_default"); rc=$?
261ad6
+    if [ $debug_attributes -eq 1 ]; then
261ad6
+        dstr=$(date)
261ad6
+        echo "$dstr: SAPHana: crm_attribute -N ${attr_node} -G -n \"$attr_name\" -l $attr_store -q --> $attr_val" >> /var/log/fhATTRIBUTE
261ad6
+    fi
261ad6
+    echo "$attr_val"
261ad6
     super_ocf_log info "FLOW $FUNCNAME rc=$rc"
261ad6
     return $rc
261ad6
 }
261ad6
@@ -381,6 +389,10 @@ function set_hana_attribute()
261ad6
     if [ "$attr_old" != "$attr_value" ]; then
261ad6
         super_ocf_log debug "DBG: SET attribute $attr_name for node ${attr_node} to ${attr_value} former ($attr_old) get_rc=$get_rc "
261ad6
         crm_attribute -N $attr_node -v $attr_value -n "$attr_name" -l $attr_store; rc=$?
261ad6
+        if [ $debug_attributes -eq 1 ]; then
261ad6
+            dstr=$(date)
261ad6
+            echo "$dstr: SAPHana: crm_attribute -N $attr_node -v $attr_value -n \"$attr_name\" -l $attr_store" >> /var/log/fhATTRIBUTE
261ad6
+        fi
261ad6
     else
261ad6
         super_ocf_log debug "DBG: LET attribute $attr_name for node ${attr_node} still be ${attr_value}"
261ad6
         rc=0
261ad6
@@ -448,7 +460,7 @@ scoring_crm_master()
261ad6
     local roles="$1"
261ad6
     local sync="$2"
261ad6
     local skip=0
261ad6
-    local myScore=-1
261ad6
+    local myScore=""
261ad6
     for scan in "${SCORING_TABLE_PREFERRED_SITE_TAKEOVER[@]}"; do
261ad6
         if [ $skip -eq 0 ]; then
261ad6
             read rolePatt syncPatt score <<< $scan
261ad6
@@ -461,7 +473,10 @@ scoring_crm_master()
261ad6
         fi
261ad6
     done
261ad6
     super_ocf_log debug "DBG: scoring_crm_master adjust score $myScore"
261ad6
-    set_crm_master $myScore
261ad6
+    # TODO: PRIO1: DO Not Score, If we did not found our role/sync at this moment - bsc#919925
261ad6
+    if [ -n "$myScore" ]; then
261ad6
+        set_crm_master $myScore
261ad6
+    fi
261ad6
 }
261ad6
 
261ad6
 #
261ad6
@@ -1068,6 +1083,27 @@ function saphana_start_primary()
261ad6
     case "$lpa_dec" in
261ad6
         0 ) # LPA says start-up
261ad6
             lpa_advice="start"
261ad6
+            # TODO: PRIO1: We need to do a special handling for remote being a 234-Secondary in SR Status SOK
261ad6
+            # if ( remote_role like [234]:S )  && ( remote_sync_status is SOK|PRIM ) && ( PreferSiteTakeover ) 
261ad6
+            #   then lpa_advice="wait"
261ad6
+            remoteRole=$(get_hana_attribute $remoteNode ${ATTR_NAME_HANA_ROLES[@]})
261ad6
+            remoteSync=$(get_hana_attribute $remoteNode ${ATTR_NAME_HANA_SYNC_STATUS[@]})
261ad6
+            super_ocf_log info "DEC: saphana_primary - checking remoteStatus"
261ad6
+            if ocf_is_true "${PreferSiteTakeover}"; then
261ad6
+                remoteStatus="$remoteRole:$remoteSync"
261ad6
+                case "$remoteStatus" in
261ad6
+		    [234]:S:*:SOK | [234]:S:*:PRIM )
261ad6
+		        lpa_advice="wait"
261ad6
+                        # TODO: PRIO3: Split WAIT into WAIT4TAKEOVER
261ad6
+                        super_ocf_log info "DEC: saphana_primary - waiting for secondary to takeover (SOK, PreferSiteTakover)"
261ad6
+                    ;;
261ad6
+                    * )
261ad6
+                        super_ocf_log info "DEC: saphana_primary - remoteStatus is: $remoteStatus"
261ad6
+                        ;;
261ad6
+                esac
261ad6
+            else
261ad6
+                super_ocf_log info "DEC: saphana_primary - PreferSiteTakeover set to false"
261ad6
+            fi
261ad6
             ;;
261ad6
         1)  # LPA says register!
261ad6
             lpa_advice="register"
261ad6
@@ -1075,7 +1111,7 @@ function saphana_start_primary()
261ad6
         2)  # LPA says wait for second LPT
261ad6
             lpa_advice="wait"
261ad6
             ;;
261ad6
-        3 | 4 ) # LPA says something is completely wrong - FAIL resource
261ad6
+        3 | 4 ) # LPA says something is completely wrong - FAIL resource # TODO: PRIO1: RC3 for waiting remote side to report lss
261ad6
             lpa_advice="fail"
261ad6
             ;;
261ad6
         * ) # LPA failed with an unkonown status - FAIL resource
261ad6
@@ -1098,7 +1134,7 @@ function saphana_start_primary()
261ad6
                     super_ocf_log info "LPA: landcape: UP, LPA: start ==> keep running"
261ad6
                     LPTloc=$(date '+%s')
261ad6
                     lpa_set_lpt $LPTloc
261ad6
-                    rc=$OCF_SUCCSESS
261ad6
+                    rc=$OCF_SUCCESS
261ad6
                     ;;
261ad6
                 1 ) # landcape says we are down, lets start and adjust scores and return code
261ad6
                     super_ocf_log info "LPA: landcape: DOWN, LPA: start ==> start instance"
261ad6
@@ -1149,7 +1185,7 @@ function saphana_start_primary()
261ad6
             case "$lss" in
261ad6
                 2 | 3 | 4 ) # as we ARE up we just keep it up
261ad6
                     # TODO: PRIO3: I now change from "just keep it up to take that down"
261ad6
-                    # TODO: PRIO3: OCF_SUCCSESS, OCF_NOT_RUNNING or OCF_ERR_xxxx ?
261ad6
+                    # TODO: PRIO3: OCF_SUCCESS, OCF_NOT_RUNNING or OCF_ERR_xxxx ?
261ad6
                     set_crm_master -9000
261ad6
                     #scoring_crm_master "$my_role" "$my_sync"
261ad6
                     rc=$OCF_ERR_GENERIC
261ad6
@@ -1159,7 +1195,7 @@ function saphana_start_primary()
261ad6
                     # TODO: PRIO3: Check, if WAITING is correct here
261ad6
                     set_hana_attribute ${NODENAME} "WAITING" ${ATTR_NAME_HANA_CLONE_STATE[@]}
261ad6
                     set_crm_master -9000
261ad6
-                    rc=$OCF_SUCCSESS
261ad6
+                    rc=$OCF_SUCCESS
261ad6
                     ;;
261ad6
             esac
261ad6
             ;;
261ad6
@@ -1277,7 +1313,7 @@ function saphana_start_secondary()
261ad6
                super_ocf_log info "ACT: PRIMARY seams to be down now ==> WAITING"
261ad6
                set_hana_attribute ${NODENAME} "WAITING" ${ATTR_NAME_HANA_CLONE_STATE[@]}
261ad6
                set_crm_master -INFINITY
261ad6
-               rc=$OCF_SUCCSESS
261ad6
+               rc=$OCF_SUCCESS
261ad6
            fi
261ad6
        else
261ad6
                lpa_set_lpt  30
261ad6
@@ -1286,7 +1322,7 @@ function saphana_start_secondary()
261ad6
        super_ocf_log info "ACT: wait_for_primary_master ==> WAITING"
261ad6
        set_hana_attribute ${NODENAME} "WAITING" ${ATTR_NAME_HANA_CLONE_STATE[@]}
261ad6
        set_crm_master -INFINITY
261ad6
-       rc=$OCF_SUCCSESS
261ad6
+       rc=$OCF_SUCCESS
261ad6
     fi
261ad6
     super_ocf_log info "FLOW $FUNCNAME rc=$rc"
261ad6
     return $rc
261ad6
@@ -1453,7 +1489,8 @@ function lpa_init_lpt() {
261ad6
 #               LPTlocal > LPTremore ===> rc=0 (start) 
261ad6
 #               LPTRemote > LPTlocal ===> rc=1 (register)
261ad6
 #            Stalemate in all other cases ==> STALEMATE-HANDLING ===> rc=2 (wait)
261ad6
-#    LPTRemote is not initialized (0)
261ad6
+#    LPTRemote is not initialized or node not kown in cluster (crm_mon -l) (0)
261ad6
+#    TODO: PRIO1: Need to introduce a return-code 3 for remote sides lpa not ready
261ad6
 #        THEN:
261ad6
 #            WAIT ==> like STALEMATE-HANDLING ===> rc=2 (wait)
261ad6
 #    
261ad6
@@ -1625,7 +1662,6 @@ function saphana_monitor_primary()
261ad6
                     else
261ad6
                        super_ocf_log info "LPA: Dual primary detected and AUTOMATED_REGISTER='false' ==> WAITING"
261ad6
                     fi
261ad6
-
261ad6
                     return $OCF_SUCCESS
261ad6
                 fi                             
261ad6
                 promoted=0;
261ad6
@@ -1853,11 +1889,11 @@ function saphana_monitor_secondary()
261ad6
                     scoring_crm_master "$my_role" "$my_sync"
261ad6
                     ;;
261ad6
                 "SFAIL" ) # This is currently NOT a possible node to promote
261ad6
-                    super_ocf_log info "DEC: secondary with sync status FAILED ==> EXCLUDE as posible takeover node"
261ad6
+                    super_ocf_log info "DEC: secondary with sync status FAILED ==> EXCLUDE as possible takeover node"
261ad6
                     set_crm_master -INFINITY
261ad6
                     ;;
261ad6
                 "*" )     # Unknown sync status
261ad6
-                    super_ocf_log info "DEC: secondary with sync status UKNOWN/UNDEFINED ==> EXCLUDE as posible takeover node"
261ad6
+                    super_ocf_log info "DEC: secondary with sync status UKNOWN/UNDEFINED ==> EXCLUDE as possible takeover node"
261ad6
                     set_crm_master -INFINITY
261ad6
                     ;;
261ad6
             esac
261ad6
@@ -1889,10 +1925,12 @@ function saphana_monitor_clone() {
261ad6
 	local rc=$OCF_ERR_GENERIC
261ad6
 	local promoted=0
261ad6
     local init_attribute=0
261ad6
+    local lpaRc=0
261ad6
+    local mRc=0
261ad6
+    local myMaster=-1
261ad6
 
261ad6
     my_role=$(get_hana_attribute ${NODENAME} ${ATTR_NAME_HANA_ROLES[@]})
261ad6
     my_sync=$(get_hana_attribute ${NODENAME} ${ATTR_NAME_HANA_SYNC_STATUS[@]})
261ad6
-    lpa_check_lpt_status  # TODO: PRIO3 : remove that line later - its only to call lpa_check_lpt_status much more often for checking
261ad6
 
261ad6
 	if ocf_is_probe; then
261ad6
 		super_ocf_log debug "DBG: PROBE ONLY"
261ad6
@@ -1904,6 +1942,16 @@ function saphana_monitor_clone() {
261ad6
 	# 
261ad6
 	check_for_primary; primary_status=$?
261ad6
     if [ $primary_status -eq $HANA_STATE_PRIMARY ]; then
261ad6
+        # FIX: bsc#919925 Leaving Node Maintenance stops HANA Resource Agent
261ad6
+        # TODO: PRIO1: Maybe we need a lpa-check here to
261ad6
+        if ocf_is_probe; then
261ad6
+            myMaster=$(get_crm_master); mRc=$?
261ad6
+            if [ $mRc -ne 0 ]; then
261ad6
+               set_crm_master 5
261ad6
+            elif [ $myMaster -eq -1 ]; then
261ad6
+               set_crm_master 5
261ad6
+            fi
261ad6
+        fi
261ad6
         saphana_monitor_primary; rc=$?
261ad6
     else
261ad6
         if [ $primary_status -eq $HANA_STATE_SECONDARY  ]; then
261ad6
diff --git a/heartbeat/SAPHanaTopology b/heartbeat/SAPHanaTopology
261ad6
index 082ad29..1d4887f 100644
261ad6
--- a/heartbeat/SAPHanaTopology
261ad6
+++ b/heartbeat/SAPHanaTopology
261ad6
@@ -14,6 +14,7 @@
261ad6
 # Support:      linux@sap.com
261ad6
 # License:      GNU General Public License (GPL)
261ad6
 # Copyright:    (c) 2014 SUSE Linux Products GmbH
261ad6
+#               (c) 2015 SUSE Linux GmbH
261ad6
 #
261ad6
 # An example usage: 
261ad6
 #      See usage() function below for more details...
261ad6
@@ -39,6 +40,8 @@ HANA_STATE_SECONDARY=1
261ad6
 HANA_STATE_STANDALONE=2
261ad6
 HANA_STATE_DEFECT=3
261ad6
 
261ad6
+debug_attributes=0
261ad6
+
261ad6
 SH=/bin/sh
261ad6
 
261ad6
 #
261ad6
@@ -123,7 +126,7 @@ function sht_meta_data() {
261ad6
 
261ad6
 
261ad6
 <resource-agent name="SAPHanaTopology">
261ad6
-    <version>0.149.4</version>
261ad6
+    <version>0.149.6</version>
261ad6
     <shortdesc lang="en">Analyzes SAP HANA System Replication Topology.</shortdesc>
261ad6
     <longdesc lang="en">This RA analyzes the SAP HANA topology and "sends" all findings via the node status attributes to
261ad6
         all nodes in the cluster. These attributes are taken by the SAPHana RA to control the SAP Hana Databases.
261ad6
@@ -205,7 +208,13 @@ function get_hana_attribute()
261ad6
     local attr_node=$1
261ad6
     local attr_name=$2
261ad6
     local attr_store=${3:-reboot} # DONE: PRIO5 get this (optional) from parameter
261ad6
-    crm_attribute -N ${attr_node} -G -n "$attr_name" -l $attr_store -q; rc=$?
261ad6
+    local attr_val=""
261ad6
+    attr_val=$(crm_attribute -N ${attr_node} -G -n "$attr_name" -l $attr_store -q); rc=$?
261ad6
+    if [ $debug_attributes -eq 1 ]; then
261ad6
+        dstr=$(date)
261ad6
+        echo "$dstr: SAPHanaTopology: crm_attribute -N ${attr_node} -G -n \"$attr_name\" -l $attr_store -q --> $attr_val" >> /var/log/fhATTRIBUTE
261ad6
+    fi
261ad6
+    echo "$attr_val"
261ad6
     if [ $rc -ne 0 ]; then
261ad6
            super_ocf_log debug "DBG: ATTRIBUTE-FAILURE: crm_attribute -N $attr_node -G -n "$attr_name" -l $attr_store -q"
261ad6
     fi
261ad6
@@ -230,6 +239,10 @@ function set_hana_attribute()
261ad6
     attr_old=$(get_hana_attribute $attr_node $attr_name $attr_store); get_rc=$?
261ad6
     if [ "$attr_old" != "$attr_value" ]; then
261ad6
         super_ocf_log debug "DBG: SET attribute $attr_name for node ${attr_node} to ${attr_value} former ($attr_old) get_rc=$get_rc "
261ad6
+        if [ $debug_attributes -eq 1 ]; then
261ad6
+            dstr=$(date)
261ad6
+            echo "$dstr: SAPHanaTopology: crm_attribute -N $attr_node -v $attr_value -n \"$attr_name\" -l $attr_store" >> /var/log/fhATTRIBUTE
261ad6
+        fi
261ad6
         crm_attribute -N $attr_node -v "$attr_value" -n "$attr_name" -l $attr_store; rc=$?
261ad6
         if [ $rc -ne 0 ]; then
261ad6
            super_ocf_log debug "DBG: ATTRIBUTE-FAILURE: crm_attribute -N $attr_node -v $attr_value -n "$attr_name" -l $attr_store"
261ad6
@@ -377,18 +390,32 @@ function sht_init() {
261ad6
        *openais* ) nodelist=$(crm_node -l | awk '/member/ {print $2}');;    
261ad6
        *cman*    ) nodelist=$(crm_node -l);; 
261ad6
     esac
261ad6
+    #### SAP-CALL
261ad6
     hdbANSWER=$(su - ${sidadm} -c "hdbnsutil -sr_state --sapcontrol=1" 2>/dev/null)
261ad6
     super_ocf_log debug "DBG2: hdbANSWER=\$\(su - ${sidadm} -c \"hdbnsutil -sr_state --sapcontrol=1\"\)"
261ad6
     site=$(echo "$hdbANSWER" | awk -F= '/site name/ {print $2}')
261ad6
     srmode=$(echo "$hdbANSWER" | awk -F= '/mode/ {print $2}')
261ad6
-    MAPPING=$(echo "$hdbANSWER" | awk -F[=/] '$1 ~ "mapping" && $3 !~ site { print $4 }' site=$site)
261ad6
+    if [ $debug_attributes -eq 1 ]; then
261ad6
+        dstr=$(date)
261ad6
+        echo "$dstr: SAPHanaTopology: srmode=$srmode" >> /var/log/fhATTRIBUTE
261ad6
+    fi
261ad6
+    MAPPING=$(echo "$hdbANSWER" | awk -F[=/] '$1 == "mapping" && $3 != site { print $4 }' site=$site)
261ad6
     super_ocf_log debug "DBG: site=$site, mode=$srmode, MAPPING=$MAPPING"
261ad6
     #
261ad6
     # filter all non-cluster mappings
261ad6
     #
261ad6
-    hanaRemoteHost=$(for n1 in $nodelist; do for n2 in $MAPPING; do if [ "$n1" == "$n2" ]; then echo $n1; fi; done; done )
261ad6
-        super_ocf_log info "DEC: site=$site, mode=$srmode, MAPPING=$MAPPING, hanaRemoteHost=$hanaRemoteHost"
261ad6
-        super_ocf_log debug "DBG: site=$site, mode=$srmode, MAPPING=$MAPPING, hanaRemoteHost=$hanaRemoteHost"
261ad6
+    # DONE: PRIO2: Need mapping between HANA HOSTS not cluster NODES
261ad6
+    local hanaVHost
261ad6
+    hanaRemoteHost=$(for n1 in $nodelist; do
261ad6
+          hanaVHost=$(get_hana_attribute ${n1} ${ATTR_NAME_HANA_VHOST[@]})
261ad6
+          for n2 in $MAPPING; do
261ad6
+             if [ "$hanaVHost" == "$n2" ]; then
261ad6
+                echo $hanaVHost;
261ad6
+             fi;
261ad6
+          done;
261ad6
+      done )
261ad6
+    super_ocf_log info "DEC: site=$site, mode=$srmode, MAPPING=$MAPPING, hanaRemoteHost=$hanaRemoteHost"
261ad6
+    super_ocf_log debug "DBG: site=$site, mode=$srmode, MAPPING=$MAPPING, hanaRemoteHost=$hanaRemoteHost"
261ad6
     super_ocf_log info "FLOW $FUNCNAME rc=$OCF_SUCCESS"
261ad6
     return $OCF_SUCCESS
261ad6
 }  
261ad6
@@ -422,6 +449,7 @@ function check_for_primary() {
261ad6
 	          super_ocf_log err "ACT: check_for_primary:  we didn't expect node_status to be: <$node_status>"
261ad6
                   dump=$( echo $node_status | hexdump -C );
261ad6
 	          super_ocf_log err "ACT: check_for_primary:  we didn't expect node_status to be: DUMP <$dump>"
261ad6
+                  #### SAP-CALL
261ad6
                   node_full_status=$(su - ${sidadm} -c "hdbnsutil -sr_state" 2>/dev/null )
261ad6
                   node_status=$(echo "$node_full_status" | awk '$1=="mode:" {print $2}')
261ad6
                   super_ocf_log info "DEC: check_for_primary: loop=$i: node_status=$node_status"
261ad6
@@ -440,6 +468,7 @@ function check_for_primary() {
261ad6
 #
261ad6
 function start_saphostagent()
261ad6
 {
261ad6
+    ### SAP-CALL
261ad6
     if [ -x "${HOSTEXEC_PATH}" ]; then
261ad6
         ${HOSTEXEC_PATH} pf=${HOSTEXEC_PROFILE_PATH}
261ad6
     fi
261ad6
@@ -453,9 +482,10 @@ function start_saphostagent()
261ad6
 #
261ad6
 function stop_saphostagent()
261ad6
 {
261ad6
-        if [ -x "${HOSTEXEC_PATH}" ]; then
261ad6
-                ${HOSTEXEC_PATH} -stop
261ad6
-        fi
261ad6
+    ### SAP-CALL
261ad6
+    if [ -x "${HOSTEXEC_PATH}" ]; then
261ad6
+        ${HOSTEXEC_PATH} -stop
261ad6
+    fi
261ad6
 }
261ad6
 
261ad6
 #
261ad6
@@ -586,7 +616,7 @@ function sht_validate() {
261ad6
 #
261ad6
 function sht_start_clone() {
261ad6
     super_ocf_log info "FLOW $FUNCNAME ($*)"
261ad6
-       local rc=$OCF_NOT_RUNNING
261ad6
+    local rc=$OCF_NOT_RUNNING
261ad6
     sht_start; rc=$?
261ad6
     return $rc
261ad6
 }
261ad6
@@ -666,27 +696,30 @@ function sht_monitor_clone() {
261ad6
     # DONE: PRIO1: ASK: Is the output format of ListInstances fix? Could we take that as an API?
261ad6
     # try to catch:  Inst Info : LNX - 42 - lv9041 - 740, patch 36, changelist 1444691
261ad6
     # We rely on the following format: SID is word#4, NR is work#6, vHost is word#8
261ad6
+    #### SAP-CALL
261ad6
     vName=$(/usr/sap/hostctrl/exe/saphostctrl -function ListInstances \
261ad6
         | awk '$4 == SID && $6=NR { print $8 }' SID=$SID NR=$InstanceNr 2>/dev/null )
261ad6
-    super_ocf_log debug "DBG: ListInstances: $(/usr/sap/hostctrl/exe/saphostctrl -function ListInstances)"
261ad6
+    # super_ocf_log debug "DBG: ListInstances: $(/usr/sap/hostctrl/exe/saphostctrl -function ListInstances)"
261ad6
     if [ -n "$vName" ]; then
261ad6
        set_hana_attribute ${NODENAME} "$vName" ${ATTR_NAME_HANA_VHOST[@]} 
261ad6
     else
261ad6
        vName=$(get_hana_attribute ${NODENAME} ${ATTR_NAME_HANA_VHOST[@]})
261ad6
     fi
261ad6
     #site=$(get_site_name)
261ad6
+    #### SAP-CALL
261ad6
     hanaANSWER=$(su - $sidadm -c "python exe/python_support/landscapeHostConfiguration.py" 2>/dev/null); hanalrc="$?" 
261ad6
     hanarole=$(echo "$hanaANSWER" | tr -d ' ' | awk -F'|' '$2 == host {  printf "%s:%s:%s:%s\n",$10,$11,$12,$13 }  ' host=${vName})
261ad6
     #if [ -z "$MAPPING" ]; then
261ad6
     #   super_ocf_log info "ACT: Did not find remote Host at this moment"
261ad6
     #fi
261ad6
-    # FH TODO PRIO1: TRY TO GET RID OF "ATTR_NAME_HANA_REMOTEHOST"
261ad6
+    # FH TODO PRIO3: TRY TO GET RID OF "ATTR_NAME_HANA_REMOTEHOST"
261ad6
     if [ -n "$hanaRemoteHost" ]; then
261ad6
         set_hana_attribute ${NODENAME} "$hanaRemoteHost" ${ATTR_NAME_HANA_REMOTEHOST[@]} 
261ad6
     fi
261ad6
     set_hana_attribute ${NODENAME} "$hanalrc:$hanaPrim:$hanarole" ${ATTR_NAME_HANA_ROLES[@]} 
261ad6
-    set_hana_attribute ${NODENAME} "$site" ${ATTR_NAME_HANA_SITE[@]} 
261ad6
-    set_hana_attribute ${NODENAME} "$vName" ${ATTR_NAME_HANA_VHOST[@]} 
261ad6
+    if [ -n "$site" ]; then
261ad6
+        set_hana_attribute ${NODENAME} "$site" ${ATTR_NAME_HANA_SITE[@]}
261ad6
+    fi
261ad6
     case "$hanaPrim" in
261ad6
        P ) ;;
261ad6
        S ) # only secondary may propargate its sync status
261ad6
@@ -701,7 +734,6 @@ function sht_monitor_clone() {
261ad6
         done
261ad6
           ;;
261ad6
     esac
261ad6
-    #ATTR_NAME_HANA_STATUS  # TODO: PRIO5: For SCALE-OUT: Fill that attribute later
261ad6
     super_ocf_log info "FLOW $FUNCNAME rc=$rc"
261ad6
     return $rc
261ad6
 }