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
This commit is contained in:
parent
b5ecde2f27
commit
3da1e76610
|
@ -349,7 +349,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')
|
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
|
for v in ${VIPS_TO_MOVE}; do
|
||||||
echo "Moving VIP $v on another node"
|
echo "Moving VIP $v on another node"
|
||||||
pcs resource move $v --wait=300
|
pcs resource ban $v ${CLUSTER_NODE} --wait=300
|
||||||
done
|
done
|
||||||
echo "Removing the location constraints that were created to move the VIPs"
|
echo "Removing the location constraints that were created to move the VIPs"
|
||||||
for v in ${VIPS_TO_MOVE}; do
|
for v in ${VIPS_TO_MOVE}; do
|
||||||
|
|
Loading…
Reference in New Issue