From 6ddae42c0df7fa1247ca0a1652c023fa07309e9a Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Tue, 11 Mar 2014 07:58:28 +0100 Subject: [PATCH] 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. --- definitions/pacemaker_vip_primitive.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/definitions/pacemaker_vip_primitive.rb b/definitions/pacemaker_vip_primitive.rb index 89565b4..f2d3255 100644 --- a/definitions/pacemaker_vip_primitive.rb +++ b/definitions/pacemaker_vip_primitive.rb @@ -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