Skip to content

Commit

Permalink
ovn-central: check raft inconsistency from nb/sb logs (#3532)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
  • Loading branch information
zhangzujian committed Dec 16, 2023
1 parent 2a499b4 commit e88e5b2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dist/images/ovn-healthcheck.sh
Expand Up @@ -30,3 +30,19 @@ if echo ${sb_status} | grep "disconnected" && echo ${sb_role} | grep "candidate"
echo "sb health check failed"
exit 1
fi

set +o pipefail

# check nb/sb log file
function check_log_file() {
local log_file="/var/log/ovn/ovsdb-server-$1.log"
if [ -e $log_file ]; then
if grep -wE '(opened log file)|(does not match prerequisite)' $log_file 2>/dev/null | tail -n 1 | grep 'does not match prerequisite' ; then
echo "raft inconsistency in $1 db was detected, please check $log_file for more details."
return 1
fi
fi
}

check_log_file nb
check_log_file sb

0 comments on commit e88e5b2

Please sign in to comment.