You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/02/27 06:21:36 UTC

[GitHub] ustcweizhou commented on issue #2458: CLOUDSTACK-10296: Find time different from last timestamp

ustcweizhou commented on issue #2458: CLOUDSTACK-10296: Find time different from last timestamp
URL: https://github.com/apache/cloudstack/pull/2458#issuecomment-368760532
 
 
   We met the issue several times on our production.
   the final change is
   ```
   diff --git a/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ b/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
   index 6a0d8a9..a8ddc7d 100755
   --- a/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
   +++ b/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
   @@ -19,14 +19,29 @@
    ROUTER_BIN_PATH=/ramdisk/rrouter
    ROUTER_LOG=${ROUTER_BIN_PATH}/keepalived.log
    STRIKE_FILE="$ROUTER_BIN_PATH/keepalived.strikes"
   +CHECKTIME_FILE="$ROUTER_BIN_PATH/keepalived.checktime"
   
    if [ -e $ROUTER_BIN_PATH/keepalived.ts2 ]
    then
        thistime=$(cat $ROUTER_BIN_PATH/keepalived.ts)
        lasttime=$(cat $ROUTER_BIN_PATH/keepalived.ts2)
   -    diff=$(($lasttime - $thistime))
   +    diff=$(($thistime - $lasttime))
   +    lastcheck=0
   +    if [ -e $CHECKTIME_FILE ]
   +    then
   +        lastcheck=`cat $CHECKTIME_FILE 2>/dev/null`
   +    fi
   +    thischeck=$(date +%s)
   +    checkdiff=$(($thischeck - $lastcheck))
   +    echo "thischeck: $thischeck, lastcheck: $lastcheck. this heartbeat: $thistime, last heartbeat: $lasttime, time diff: $diff" >> $ROUTER_LOG
   +    if [ $checkdiff -ge 0 ] && [ $checkdiff -lt 30 ]
   +    then
   +        echo time duration after last check is less than 30 seconds, ignored >> $ROUTER_LOG
   +        exit
   +    fi
   +    echo $thischeck > $CHECKTIME_FILE
        s=0
   -    if [ $diff -ge 10 ]
   +    if [ $diff -lt 30 ]
        then
            if [ -e $STRIKE_FILE ]
            then
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services