Top
PRIMECLUSTER Global Link Services Configuration and AdministrationGuide 4.6Redundant Line Control Function
FUJITSU Software

3.12.3 Setting suppression of stopping userApplication when entire transfer routes fails

The function to suppress stopping userApplication when entire transfer routes fails can be used.

For details, refer to "2.8.3 Suppression of stopping userApplication when entire transfer routes fails"

The following settings must be made to suppress stopping userApplication.

A sample file (preStartGls.sh) is provided.

If the configuration described in "2.8.3 Suppression of stopping userApplication when entire transfer routes fails" is satisfied, it is not necessary to change the sample file.

Make sure that change the sample file as necessary, for example, to output a message to the system log.

  1. Place the scripts on both the operation node and standby node.
    When placing a script, make sure that the directory and script name are the same on the operation node and standby node.
    The script name can be changed from the sample file name (preStartGrs.sh).

  2. Register the placed script with the userApplication PreOnline script.
    PreOnline scripts can be registered using RMS Wizard.
    For information about PreOnline scripts, refer to "PRIMECLUSTER Installation and Administration Guide"

[Sample file]

- preStartGls.sh

#!/bin/bash
#
# Copyright(c) 2022 FUJITSU LIMITED.
# All rights reserved.
#
LANG=C
#-------------------------------------------------------
# variables
#-------------------------------------------------------
STATE_STANDBY="Standby"
STATE_FAULTED="Faulted"
CFGLOG="/var/opt/FJSVhanet/log/config.log"
PROGNAME=`/bin/basename $0`
HANETPOLL="/opt/FJSVhanet/usr/sbin/hanetpoll"
HANETPOLL_OFF="${HANETPOLL} off"
HANETPOLL_ON_YES="${HANETPOLL} on -f yes"
HANETPOLL_ON_NO="${HANETPOLL} on -f no"
RCCMDDIR="/usr/opt/reliant/bin"
HVASSERT="${RCCMDDIR}/hvassert"
HANETSELECT="hanetselect"
MSG_OFFLINE="ERROR: Remote system is not online"
MSG_TIMEOUT="Command timed out!"
MSG_STANDBY="ERROR: Actual resource state is - Standby"
HVDISP="${RCCMDDIR}/hvdisp"
ECHO="echo"  #bash built-in command
LOGGER="/usr/bin/logger"
GREP="/bin/grep"
AWK="/bin/awk"
SED="/bin/sed"
PGREP="/usr/bin/pgrep"
DATE="/bin/date"

# flag to output a message 
SYSLOG_OUTPUT="off"

#-------------------------------------------------------
# functions
#-------------------------------------------------------
HAnetLog(){
    if [ -f ${CFGLOG} ]; then
        DATETIME=`${DATE} +"%Y/%m/%d %H:%M:%S.%3N"`
        ${ECHO} "[${DATETIME}] - [${PROGNAME}] [$$] $*" >> ${CFGLOG}
    fi
    return 0
}

HAnetSysLog(){
    log_str=$*
    if [ ${SYSLOG_OUTPUT} != "off" ]; then
        ${LOGGER} -t "hanet:${PROGNAME}" -p user.err "${log_str}" >/dev/null 2>&1
    fi
    HAnetLog ${log_str}
    return 0
}

PollExec(){

    # hanetpoll off
    poll_result=`${HANETPOLL_OFF} 2>&1`
    ret=$?
    if [ ${ret} -ne 0 ]; then
        # check hanetselect
        pgrep_result=`${PGREP} -x ${HANETSELECT}`
        if [[ ${pgrep_result} != "" ]]; then
            # exist hanetselect
            if [ -z "${poll_result}" ]; then
                poll_result="ERROR:${HANETPOLL_OFF}"
            fi
            HAnetSysLog ${poll_result}
            exit 0
        else
            HAnetLog "Polling is already stopped.  ${poll_result}"
        fi
    fi

    # hanetpoll on
    result=`$* 2>&1`
    ret=$?
    if [ ${ret} -ne 0 ]; then
        if [ -z "${result}" ]; then
            result="ERROR:$*"
        fi
        HAnetSysLog ${result}
        exit 0
    fi
    return 0
}

#-------------------------------------------------------
#   main
#-------------------------------------------------------
### In the case of Standby ( After transition )#########
if [[ ${HV_INTENDED_STATE} = ${STATE_STANDBY} ]];then
    # After state is Standby. Set no.
    PollExec ${HANETPOLL_ON_NO}
    exit 0
fi


### Get remote SysNode name ############################
remote_node=`${HVDISP} ${HV_APPLICATION} | ${AWK} \
'$1=="PriorityList" { gsub("PriorityList|'${RELIANT_HOSTNAME}'|:", ""); print $1}'`
if [[ ${remote_node} = "" ]]; then
    HAnetSysLog "Remote SysNode name is not set."
    exit 0
fi


### hvassert ###########################################
# hvassert -h node1RMS -s app1 Faulted
result=`${HVASSERT} -h ${remote_node} -s ${HV_APPLICATION} ${STATE_FAULTED} 2>&1`
ret=$?
if [ ${ret} -eq 0 ]; then
    # Last Node: hanetpoll off -> hanetpoll on -f no
    PollExec ${HANETPOLL_ON_NO}
else
    case "${result}" in

        # Remote SysNode is OFFLINE.
        *${MSG_OFFLINE}* )
            HAnetLog ${result}
            # Offline: hanetpoll off -> hanetpoll on -f no
            PollExec ${HANETPOLL_ON_NO}
            ;;
        # Command is timeout.
        *${MSG_TIMEOUT}* )
            # Timeout: hanetpoll off -> hanetpoll on -f yes
            HAnetLog ${result}
            PollExec ${HANETPOLL_ON_YES}
            ;;
        *${MSG_STANDBY}* )
            # other case Standby is normal case.: hanetpoll off -> hanetpoll on -f yes
            PollExec ${HANETPOLL_ON_YES}
            ;;
        * )
            # other case: hanetpoll off -> hanetpoll on -f yes
            HAnetLog ${result}
            PollExec ${HANETPOLL_ON_YES}
            ;;
    esac
fi

exit 0