Allow a retry when creating a VIP primitive in pacemaker_vip_primitive

As nodes will race to initially create the VIP primitive, they will
likely hit some failure because only one can obviously create it. Once
it's created, there's no issue as there's a check for existence.
This commit is contained in:
Vincent Untz 2014-03-11 07:58:28 +01:00
parent 1f3542d5a0
commit 6ddae42c0d

View File

@ -4,6 +4,8 @@ define :pacemaker_vip_primitive, :cb_network => nil, :hostname => nil, :domain =
primitive_name = "#{params[:hostname]}-vip-#{params[:cb_network]}"
# Allow one retry, to avoid races where two nodes create the primitive at the
# same time when it wasn't created yet (only one can obviously succeed)
pacemaker_primitive primitive_name do
agent "ocf:heartbeat:IPaddr2"
params ({
@ -11,6 +13,8 @@ define :pacemaker_vip_primitive, :cb_network => nil, :hostname => nil, :domain =
})
op params[:op]
action :create
retries 1
retry_delay 5
end
# we return the primitive name so that the caller can use it as part of a