[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16378106#comment-16378106
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10296:
---------------------------------------------

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:
us...@infra.apache.org


> Fix timestamp difference in heartbeat script for rVRs
> -----------------------------------------------------
>
>                 Key: CLOUDSTACK-10296
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10296
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>    Affects Versions: 4.11.0.0, 4.9.3.0
>            Reporter: Rohit Yadav
>            Assignee: Rohit Yadav
>            Priority: Major
>             Fix For: 4.11.1.1
>
>
> Raised recently on dev@ ML by Jayakartheek, the difference code in heartbeat 
> checker script for rVRs wrongly take difference, that will always be less 
> than or equal to 0.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to