update
This commit is contained in:
@@ -6,6 +6,7 @@ set -u
|
||||
# Guests with local storage remain on this node and are gracefully shut down.
|
||||
|
||||
HA_WAIT_SECONDS=300
|
||||
MAINTENANCE_WAIT_SECONDS=60
|
||||
SHUTDOWN_TIMEOUT=180
|
||||
LOCAL_NODE="$(hostname -s)"
|
||||
|
||||
@@ -248,11 +249,29 @@ guest_status() {
|
||||
fi
|
||||
}
|
||||
|
||||
if ! ha-manager status |
|
||||
grep -F "$LOCAL_NODE" |
|
||||
grep -q "maintenance mode"; then
|
||||
die "${LOCAL_NODE} is not in HA maintenance mode."
|
||||
fi
|
||||
wait_for_maintenance_mode() {
|
||||
local deadline=$((SECONDS + MAINTENANCE_WAIT_SECONDS))
|
||||
|
||||
log "Waiting for ${LOCAL_NODE} to enter HA maintenance mode."
|
||||
|
||||
while true; do
|
||||
if ha-manager status |
|
||||
grep -F "$LOCAL_NODE" |
|
||||
grep -q "maintenance mode"; then
|
||||
printf '\n'
|
||||
return
|
||||
fi
|
||||
|
||||
if (( SECONDS >= deadline )); then
|
||||
die "${LOCAL_NODE} did not enter HA maintenance mode within ${MAINTENANCE_WAIT_SECONDS} seconds."
|
||||
fi
|
||||
|
||||
printf '\r Waiting for HA maintenance mode... '
|
||||
sleep 2
|
||||
done
|
||||
}
|
||||
|
||||
wait_for_maintenance_mode
|
||||
|
||||
wait_for_ha_evacuation ||
|
||||
die "Resolve the remaining HA guests before continuing the evacuation."
|
||||
|
||||
Reference in New Issue
Block a user