1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-06 12:58:18 +03:00

B #6372: Add lock to raft hook script (#2899)

* This should fix issues in HA environment, where we sometimes get duplicit virtual IPs
This commit is contained in:
Pavel Czerný 2024-02-06 11:18:35 +01:00 committed by GitHub
parent b153069059
commit 5788a2528e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,9 +86,21 @@ function virtualip() {
# main
#
if [ -z "${ONE_LOCATION}" ]; then
LOCK_LOCATION=/var/lock/one
else
LOCK_LOCATION=$ONE_LOCATION/var/lock
fi
LOCK_FILE="$LOCK_LOCATION/vip_sh"
ACTION="$1"
shift
# Start of critical section (opens LOCK_FILE with fd 56)
exec 56>$LOCK_FILE
flock -w 60 56
# Process all parameters in the form of interface:IP
while [[ $# -gt 0 ]]
do