Skip to content

Commit 4dfb630

Browse files
enrico-usailukeseawalker
authored andcommitted
Revert "Convert EFA installation recipe into a resource"
This reverts commit 7108f89 Signed-off-by: Enrico Usai <[email protected]>
1 parent cd73bd9 commit 4dfb630

File tree

8 files changed

+75
-152
lines changed

8 files changed

+75
-152
lines changed

cookbooks/aws-parallelcluster-install/libraries/helpers.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,3 @@ def append_if_not_present_grub_cmdline(attributes, grub_variable)
9090
end
9191
end
9292
end
93-
94-
def efa_installed?
95-
dir_exist = ::Dir.exist?('/opt/amazon/efa')
96-
if dir_exist
97-
modinfo_efa_stdout = Mixlib::ShellOut.new("modinfo efa").run_command.stdout
98-
efa_installed_packages_file = Mixlib::ShellOut.new("cat /opt/amazon/efa_installed_packages").run_command.stdout
99-
Chef::Log.info("`/opt/amazon/efa` directory already exists. \nmodinfo efa stdout: \n#{modinfo_efa_stdout} \nefa_installed_packages_file_content: \n#{efa_installed_packages_file}")
100-
end
101-
dir_exist
102-
end
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# frozen_string_literal: true
2+
3+
#
4+
# Cookbook:: aws-parallelcluster
5+
# Recipe:: efa
6+
#
7+
# Copyright:: 2013-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
8+
#
9+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
10+
# License. A copy of the License is located at
11+
#
12+
# http://aws.amazon.com/apache2.0/
13+
#
14+
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
15+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
efa_tarball = "#{node['cluster']['sources_dir']}/aws-efa-installer.tar.gz"
19+
efa_installed = efa_installed?
20+
21+
if efa_installed && !::File.exist?(efa_tarball)
22+
Chef::Log.warn("Existing EFA version differs from the one shipped with ParallelCluster. Skipping ParallelCluster EFA installation and configuration.")
23+
return
24+
end
25+
26+
# Get EFA Installer
27+
remote_file efa_tarball do
28+
source node['cluster']['efa']['installer_url']
29+
mode '0644'
30+
retries 3
31+
retry_delay 5
32+
not_if { ::File.exist?(efa_tarball) }
33+
end
34+
35+
# default openmpi installation conflicts with new install
36+
# new one is installed in /opt/amazon/efa/bin/
37+
case node['platform_family']
38+
when 'rhel', 'amazon'
39+
package %w(openmpi-devel openmpi) do
40+
action :remove
41+
not_if { efa_installed }
42+
end
43+
when 'debian'
44+
package "libopenmpi-dev" do
45+
action :remove
46+
not_if { efa_installed }
47+
end
48+
end
49+
50+
installer_options = "-y"
51+
# skip efa-kmod installation on not supported platforms
52+
installer_options += " -k" unless node['conditions']['efa_supported']
53+
54+
bash "install efa" do
55+
cwd node['cluster']['sources_dir']
56+
code <<-EFAINSTALL
57+
set -e
58+
tar -xzf #{efa_tarball}
59+
cd aws-efa-installer
60+
./efa_installer.sh #{installer_options}
61+
rm -rf #{node['cluster']['sources_dir']}/aws-efa-installer
62+
EFAINSTALL
63+
not_if { efa_installed }
64+
end

cookbooks/aws-parallelcluster-install/recipes/install.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
include_recipe "aws-parallelcluster-install::cloudwatch_agent"
3232
include_recipe "aws-parallelcluster-install::arm_pl" # ARM Performance Library
3333
include_recipe "aws-parallelcluster-install::intel_hpc" # Intel HPC libraries
34-
efa 'Install EFA'
3534

3635
# == ENVIRONMENT
36+
include_recipe "aws-parallelcluster-install::efa" unless virtualized?
3737
include_recipe "aws-parallelcluster-install::lustre" # FSx options
3838
include_recipe "aws-parallelcluster-install::efs" # EFS Utils
3939

cookbooks/aws-parallelcluster-install/resources/efa/efa.rb

Lines changed: 0 additions & 74 deletions
This file was deleted.

kitchen.resources.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,3 @@ suites:
8282
- recipe:aws-parallelcluster::test_dummy
8383
- recipe:aws-parallelcluster-install::directories
8484
resource: mysql_client
85-
- name: efa
86-
run_list:
87-
- recipe[aws-parallelcluster::add_dependencies]
88-
- recipe[aws-parallelcluster-install::test_resource]
89-
verifier:
90-
controls:
91-
- efa_conflicting_packages_removed
92-
- efa_installed
93-
attributes:
94-
resource: efa
95-
dependencies:
96-
- recipe:aws-parallelcluster::test_dummy
97-
- recipe:aws-parallelcluster-install::directories

kitchen.validate.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,4 @@ suites:
4949
- package_repos
5050
- install_packages
5151
- nfs
52-
- efa_conflicting_packages_removed
53-
- efa_installed
5452

libraries/helpers.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,16 @@ def kitchen_test?
499499
node['kitchen'] == 'true'
500500
end
501501

502+
def efa_installed?
503+
dir_exist = ::Dir.exist?('/opt/amazon/efa')
504+
if dir_exist
505+
modinfo_efa_stdout = Mixlib::ShellOut.new("modinfo efa").run_command.stdout
506+
efa_installed_packages_file = Mixlib::ShellOut.new("cat /opt/amazon/efa_installed_packages").run_command.stdout
507+
Chef::Log.info("`/opt/amazon/efa` directory already exists. \nmodinfo efa stdout: \n#{modinfo_efa_stdout} \nefa_installed_packages_file_content: \n#{efa_installed_packages_file}")
508+
end
509+
dir_exist
510+
end
511+
502512
# load cluster configuration file into node object
503513
def load_cluster_config
504514
ruby_block "load cluster configuration" do

test/resources/controls/aws_parallelcluster_install/efa_spec.rb

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)