Skip to content

Commit fe7d847

Browse files
Prevent mountpoint collision between ephemeral drive and shared drives (#1589)
Disable ephemeral mount if mountpoint clashes with shared file system mountpoint Set up kitchen tests for mountpoint collision for ephemeral and shared drives Signed-off-by: Jacopo De Amicis <[email protected]>
1 parent 6e5c94c commit fe7d847

File tree

2 files changed

+40
-17
lines changed
  • cookbooks
    • aws-parallelcluster-config/recipes
    • aws-parallelcluster-test/recipes

2 files changed

+40
-17
lines changed

cookbooks/aws-parallelcluster-config/recipes/base.rb

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,23 @@
2727

2828
include_recipe 'aws-parallelcluster-config::nfs' unless virtualized?
2929

30-
service "setup-ephemeral" do
31-
supports restart: false
32-
action :enable
33-
end
30+
# Mount the ephemeral drive unless there is a mountpoint collision with shared drives
31+
shared_dir_array = node['cluster']['ebs_shared_dirs'].split(',') + \
32+
node['cluster']['efs_shared_dirs'].split(',') + \
33+
node['cluster']['fsx_shared_dirs'].split(',') + \
34+
[ node['cluster']['raid_shared_dir'] ]
35+
unless shared_dir_array.include? node['cluster']['ephemeral_dir']
36+
service "setup-ephemeral" do
37+
supports restart: false
38+
action :enable
39+
end
3440

35-
# Execution timeout 3600 seconds
36-
unless virtualized?
37-
execute "Setup of ephemeral drivers" do
38-
user "root"
39-
command "/usr/local/sbin/setup-ephemeral-drives.sh"
41+
# Execution timeout 3600 seconds
42+
unless virtualized?
43+
execute "Setup of ephemeral drives" do
44+
user "root"
45+
command "/usr/local/sbin/setup-ephemeral-drives.sh"
46+
end
4047
end
4148
end
4249

cookbooks/aws-parallelcluster-test/recipes/tests.rb

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,25 @@ module load intelmpi && mpirun --help | grep '#{node['cluster']['intelmpi']['kit
334334
###################
335335
# instance store
336336
###################
337-
bash 'test instance store' do
338-
cwd Chef::Config[:file_cache_path]
339-
code <<-EPHEMERAL
337+
338+
ebs_shared_dirs_array = node['cluster']['ebs_shared_dirs'].split(',')
339+
340+
if ebs_shared_dirs_array.include? node['cluster']['ephemeral_dir']
341+
# In this case the ephemeral storage should not be mounted because the mountpoint
342+
# clashes with the mountpoint coming from t
343+
bash 'test instance store mountpoint collision' do
344+
cwd Chef::Config[:file_cache_path]
345+
user node['cluster']['cluster_user']
346+
code <<-COLLISION
347+
systemctl show setup-ephemeral.service -p ActiveState | grep "=inactive"
348+
systemctl show setup-ephemeral.service -p UnitFileState | grep "=disabled"
349+
COLLISION
350+
end
351+
else
352+
bash 'test instance store' do
353+
cwd Chef::Config[:file_cache_path]
354+
user node['cluster']['cluster_user']
355+
code <<-EPHEMERAL
340356
set -xe
341357
EPHEMERAL_DIR="#{node['cluster']['ephemeral_dir']}"
342358
@@ -389,11 +405,11 @@ module load intelmpi && mpirun --help | grep '#{node['cluster']['intelmpi']['kit
389405
mkdir -p ${EPHEMERAL_DIR}/test_dir
390406
touch ${EPHEMERAL_DIR}/test_dir/test_file
391407
fi
392-
EPHEMERAL
393-
user node['cluster']['cluster_user']
394-
end
395-
execute 'check setup-ephemeral service is enabled' do
396-
command "systemctl is-enabled setup-ephemeral"
408+
EPHEMERAL
409+
end
410+
execute 'check setup-ephemeral service is enabled' do
411+
command "systemctl is-enabled setup-ephemeral"
412+
end
397413
end
398414

399415
###################

0 commit comments

Comments
 (0)