From 2e60a22a9c798297946b459aaca33447cba0634a Mon Sep 17 00:00:00 2001 From: Sasha Andonov Date: Thu, 27 Aug 2020 11:48:58 +0200 Subject: [PATCH] pacemaker: remove node on delete (SOC-11240) On node delete, pacemaker needs to remove the node from the cluster prior to being deleted from crowbar. This change adds said feature. --- crowbar_framework/app/models/crowbar_service.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crowbar_framework/app/models/crowbar_service.rb b/crowbar_framework/app/models/crowbar_service.rb index 561cdd63ba..5f63deb1d3 100644 --- a/crowbar_framework/app/models/crowbar_service.rb +++ b/crowbar_framework/app/models/crowbar_service.rb @@ -180,6 +180,14 @@ def transition(inst, name, state) xs <=> ys end + # Make sure pacemaker is the first to execute on node delete + if state == "delete" + # As nodes cannot be part of multiple Pacemaker proposals, there + # should only be one occurence here + index = roles.index { |role| role.name.include? "pacemaker-config-" } + roles.unshift(roles.delete_at(index)) unless index.nil? + end + roles.each do |role| role.override_attributes.each do |bc, data| rname = role.name.gsub("#{bc}-config-","")