Skip to content

Commit 5907a2f

Browse files
hanwen-clusterhanwen-pcluste
authored andcommitted
Use Gem::Version to compare version
Thanks to @nyetsche for creating the initial fix PR #2776 Signed-off-by: Hanwen <[email protected]>
1 parent 449827e commit 5907a2f

File tree

5 files changed

+19
-26
lines changed

5 files changed

+19
-26
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ This file is used to list changes made in each version of the AWS ParallelCluste
99
**ENHANCEMENTS**
1010
- Allow custom actions on Login Nodes.
1111

12+
**BUG FIXES**
13+
- Fix EFA kmod installation with RHEL 8.10 or newer.
14+
1215
3.10.1
1316
------
1417

cookbooks/aws-parallelcluster-environment/resources/efa/efa_redhat8.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@
2222

2323
action_class do
2424
def efa_supported?
25-
require 'rubygems'
26-
minver = Gem::Version.new("8.4")
27-
ourver = Gem::Version.new(node['platform_version'])
28-
29-
if ourver < minver
25+
if Gem::Version.new(node['platform_version']) < Gem::Version.new("8.4")
3026
log "EFA is not supported in this RHEL version #{node['platform_version']}, supported versions are >= 8.4" do
3127
level :warn
3228
end

cookbooks/aws-parallelcluster-environment/resources/efa/efa_rocky8.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
action_class do
2424
def efa_supported?
25-
if node['platform_version'].to_f < 8.4
25+
if Gem::Version.new(node['platform_version']) < Gem::Version.new("8.4")
2626
log "EFA is not supported in this Rocky Linux version #{node['platform_version']}, supported versions are >= 8.4" do
2727
level :warn
2828
end

cookbooks/aws-parallelcluster-environment/resources/lustre/lustre_redhat8.rb

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@
2626
action :setup do
2727
version = node['platform_version']
2828
log "Installing FSx for Lustre. Platform version: #{version}, kernel version: #{node['cluster']['kernel_release']}"
29-
if version.length == 3 # If version is 8.10 or more, this block is skipped
30-
if version.to_f < 8.2
31-
raise "FSx for Lustre is not supported in this RHEL version #{version}, supported versions are >= 8.2"
32-
elsif version.to_f == 8.7 && (node['cluster']['kernel_release'].include?("4.18.0-425.3.1.el8") || node['cluster']['kernel_release'].include?("4.18.0-425.13.1.el8_7"))
33-
# Rhel8.7 kernel 4.18.0-425.3.1.el8 and 4.18.0-425.13.1.el8_7 has broken kABI compat
34-
# See https://access.redhat.com/solutions/6985596 and https://github.com/openzfs/zfs/issues/14724
35-
raise "FSx for Lustre is not supported in kernel version #{node['cluster']['kernel_release']} of RHEL #{version}, please update the kernel version"
36-
else
37-
action_install_lustre
38-
end
29+
current_version = Gem::Version.new(version)
30+
if current_version < Gem::Version.new("8.2")
31+
raise "FSx for Lustre is not supported in this RHEL version #{version}, supported versions are >= 8.2"
32+
elsif current_version == Gem::Version.new("8.7") && (node['cluster']['kernel_release'].include?("4.18.0-425.3.1.el8") || node['cluster']['kernel_release'].include?("4.18.0-425.13.1.el8_7"))
33+
# Rhel8.7 kernel 4.18.0-425.3.1.el8 and 4.18.0-425.13.1.el8_7 has broken kABI compat
34+
# See https://access.redhat.com/solutions/6985596 and https://github.com/openzfs/zfs/issues/14724
35+
raise "FSx for Lustre is not supported in kernel version #{node['cluster']['kernel_release']} of RHEL #{version}, please update the kernel version"
3936
else
4037
action_install_lustre
4138
end

cookbooks/aws-parallelcluster-environment/resources/lustre/lustre_rocky8.rb

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@
2626
action :setup do
2727
version = node['platform_version']
2828
log "Installing FSx for Lustre. Platform version: #{version}, kernel version: #{node['cluster']['kernel_release']}"
29-
if version.length == 3 # If version is 8.10 or more, this block is skipped
30-
if version.to_f < 8.2
31-
raise "FSx for Lustre is not supported in this Rocky Linux version #{version}, supported versions are >= 8.2"
32-
elsif version.to_f == 8.7 && (node['cluster']['kernel_release'].include?("4.18.0-425.3.1.el8") || node['cluster']['kernel_release'].include?("4.18.0-425.13.1.el8_7"))
33-
# Rhel8.7 kernel 4.18.0-425.3.1.el8 and 4.18.0-425.13.1.el8_7 has broken kABI compat
34-
# See https://access.redhat.com/solutions/6985596 and https://github.com/openzfs/zfs/issues/14724
35-
raise "FSx for Lustre is not supported in kernel version #{node['cluster']['kernel_release']} of Rocky Linux #{version}, please update the kernel version"
36-
else
37-
action_install_lustre
38-
end
29+
current_version = Gem::Version.new(version)
30+
if current_version < Gem::Version.new("8.2")
31+
raise "FSx for Lustre is not supported in this Rocky Linux version #{version}, supported versions are >= 8.2"
32+
elsif current_version == Gem::Version.new("8.7") && (node['cluster']['kernel_release'].include?("4.18.0-425.3.1.el8") || node['cluster']['kernel_release'].include?("4.18.0-425.13.1.el8_7"))
33+
# Rhel8.7 kernel 4.18.0-425.3.1.el8 and 4.18.0-425.13.1.el8_7 has broken kABI compat
34+
# See https://access.redhat.com/solutions/6985596 and https://github.com/openzfs/zfs/issues/14724
35+
raise "FSx for Lustre is not supported in kernel version #{node['cluster']['kernel_release']} of Rocky Linux #{version}, please update the kernel version"
3936
else
4037
action_install_lustre
4138
end

0 commit comments

Comments
 (0)