HA: fix race when moving VIP during minor update

During a minor update of a controller node, we list the
VIP hosted on the node and we force them to move away
with a pcs command.

The way we call the pcs command is racy, so change the
action to make sure the VIP move is performed only if
the VIP is still hosted on the node when we run the action.

Change-Id: Id379f4fe1668d01fdd5f91b46e2f75d7cdb577ae
Closes-Bug: #1921351
(cherry picked from commit 3da1e76610)
This commit is contained in:
Damien Ciabrini 2021-03-25 10:23:48 +01:00
parent 5325ac3116
commit de98fdb208
1 changed files with 1 additions and 1 deletions

View File

@ -358,7 +358,7 @@ outputs:
VIPS_TO_MOVE=$(crm_mon --as-xml | xmllint --xpath '//resource[@resource_agent = "ocf::heartbeat:IPaddr2" and @role = "Started" and @managed = "true" and ./node[@name = "'${CLUSTER_NODE}'"]]/@id' - | sed -e 's/id=//g' -e 's/"//g')
for v in ${VIPS_TO_MOVE}; do
echo "Moving VIP $v on another node"
pcs resource move $v --wait=300
pcs resource ban $v ${CLUSTER_NODE} --wait=300
done
echo "Removing the location constraints that were created to move the VIPs"
for v in ${VIPS_TO_MOVE}; do