File bsc#1196673-fix-detection-of-partial-upgrade.patch of Package hawk2.26930
From 077d2c86b298c16aa62cea212d181c114cb78ff3 Mon Sep 17 00:00:00 2001
From: Petr Pavlu <petr.pavlu@suse.com>
Date: Tue, 26 Apr 2022 14:52:19 +0200
Subject: [PATCH] Fix detection of partial upgrade
Partial upgrade detection is based on reading 'crm_feature_set'
operation attributes but they record only a version of the designated
controller which was active when a given operation was run. Fix this
detection by instead querying '#feature-set' transient attributes.
---
hawk/app/models/cib.rb | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/hawk/app/models/cib.rb b/hawk/app/models/cib.rb
index e304ec52..12a38c6f 100644
--- a/hawk/app/models/cib.rb
+++ b/hawk/app/models/cib.rb
@@ -828,9 +828,6 @@ class Cib
# skip notifies, deletes, cancels
next if operation == 'notify' || operation == 'delete' || operation == 'cancel'
- # set crm_feature_set in node information
- node[:crm_feature_set] = op.attributes['crm_feature_set'] if operation == 'monitor'
-
# skip allegedly pending "last_failure" ops (hack to fix bnc#706755)
# TODO(should): see if we can remove this in future
next if op.attributes.key?('id') &&
@@ -1008,12 +1005,17 @@ class Cib
# Now we can sort the node array
@nodes.sort!{|a,b| a[:uname].natcmp(b[:uname], true)}
+ # Check CRM feature set of all nodes for consistency
feature_sets = {}
@nodes.each do |n|
- if n.key? :crm_feature_set
- fs = n[:crm_feature_set]
- feature_sets[fs] ||= []
- feature_sets[fs] << n[:name]
+ next unless n[:state] == :online && !(n[:remote] || n[:host])
+ if @xml.elements.each("cib/status/node_state[@uname='#{n[:uname]}']/transient_attributes/instance_attributes/nvpair[@name='#feature-set']") do |fs_node|
+ fs = fs_node.attributes['value']
+ (feature_sets[fs] ||= []) << n[:name]
+ end.empty?
+ # The feature set attribute is present since 3.15.1. If it is missing
+ # then the node must be running an earlier version.
+ (feature_sets['<3.15.1'] ||= []) << n[:name]
end
end
if feature_sets.count > 1