1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

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

* This should fix issues in HA environment, where we sometimes get duplicated virtual IPs

(cherry picked from commit 5788a2528eb30bb576950b403c306557d001fd5e)
(cherry picked from commit bf628dc9b64f60cde65fbf8032073ec10de76362)
This commit is contained in:
Pavel Czerný 2024-02-06 11:18:35 +01:00 committed by Ruben S. Montero
parent 3b7f9fd164
commit 546d7ae4a7
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

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