Skip to content

Commit 48b5ea5

Browse files
committed
[DFSM] Revise the logic to determine if a live update is supported/required for a given changeset.
Signed-off-by: Giacomo Marciani <[email protected]>
1 parent ba7eaed commit 48b5ea5

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

cookbooks/aws-parallelcluster-slurm/libraries/storage.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ def to_s
9696
# @return [Boolean] true if the change supports live updates; false, otherwise.
9797
def storage_change_supports_live_update?(changes)
9898
if changes.nil? || changes.empty?
99-
Chef::Log.info("No change found: assuming live update is supported")
99+
Chef::Log.info("No change found: live update is supported")
100100
return true
101101
end
102102

103103
storage_changes = changes.select { |change| change["parameter"] == "SharedStorage" }
104104

105105
if storage_changes.empty?
106-
Chef::Log.info("No shared storage change found: assuming live update is supported")
107-
return false
106+
Chef::Log.info("No shared storage change found: live update is supported")
107+
return true
108108
end
109109

110110
storage_changes.each do |change|

cookbooks/aws-parallelcluster-slurm/libraries/update.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,22 @@ def is_live_update_required?
113113

114114
Chef::Log.info("Changeset found: evaluating changes #{changes}")
115115

116+
if changes.nil? || changes.empty?
117+
Chef::Log.info("No change found in changeset: live update is not required")
118+
return false
119+
end
120+
116121
outcome = case node["cluster"]["node_type"]
117122
when 'HeadNode'
118-
# The head node supports live updates regardless the content of the changeset.
123+
# The head node supports live updates regardless the content of the changeset,
124+
# because we assume here that the CLI permitted only the submission of an update with changes
125+
# that can be handled by a live update on the head node.
119126
true
120127
when 'ComputeFleet', 'LoginNode'
121128
# The compute and login nodes support live updates only in specific cases:
122-
# * changeset contains only shared storage changes that support live updates
123-
storage_change_supports_live_update?(changes)
129+
# * changeset contains only shared storage changes that support live updates
130+
only_shared_storage_change = changes.all? { |change| change["parameter"] == "SharedStorage" }
131+
only_shared_storage_change && storage_change_supports_live_update?(changes)
124132
else
125133
raise "node_type must be HeadNode, LoginNode or ComputeFleet"
126134
end

0 commit comments

Comments
 (0)