Skip to content

Commit 3b752b4

Browse files
Support mounting existing FSx for Ontap and OpenZFS
Accept two more attributes to cookbook: fsx_volume_junction_paths: It is a comma separated list. There are strings between the comma if it is FSx for Ontap and OpenZFS. There is empty if it is FSx for Lustre. fsx_fs_types: It is a comma separated list. It tells the cookbook what mount method to use according to the file system (Lustre, Ontap, OpenZFS) Signed-off-by: Hanwen <[email protected]>
1 parent 82794e7 commit 3b752b4

File tree

3 files changed

+51
-18
lines changed

3 files changed

+51
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ x.x.x
99
**ENHANCEMENTS**
1010
- Add support for multiple Elastic File Systems.
1111
- Add support for multiple FSx File System.
12+
- Add support for attaching existing FSx for Ontap and FSx for OpenZFS File Systems.
1213
- Slurm: Set `AuthInfo=cred_expire=70` to reduce the time requeued jobs must wait before starting again when nodes are not available.
1314
- Make `DirectoryService/AdditionalSssdConfigs` be merged into final SSSD configuration rather than be appended.
1415
- During cluster update set Slurm nodes state accordingly to strategy set through QueueUpdateStrategy parameter.

attributes/default.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@
518518
default['cluster']['fsx_fs_ids'] = ''
519519
default['cluster']['fsx_dns_names'] = ''
520520
default['cluster']['fsx_mount_names'] = ''
521+
default['cluster']['fsx_fs_types'] = ''
522+
default['cluster']['fsx_volume_junction_paths'] = ''
521523
default['cluster']['custom_node_package'] = nil
522524
default['cluster']['custom_awsbatchcli_package'] = nil
523525
default['cluster']['raid_shared_dir'] = ''

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

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@
1616
# limitations under the License.
1717

1818
fsx_fs_id_array = node['cluster']['fsx_fs_ids'].split(',')
19+
fsx_fs_type_array = node['cluster']['fsx_fs_types'].split(',')
1920
fsx_shared_dir_array = node['cluster']['fsx_shared_dirs'].split(',')
2021
fsx_dns_name_array = node['cluster']['fsx_dns_names'].split(',')
2122
fsx_mount_name_array = node['cluster']['fsx_mount_names'].split(',')
23+
fsx_volume_junction_path_array = node['cluster']['fsx_volume_junction_paths'].split(',')
2224
# Check to see if FSx is created
2325
fsx_fs_id_array.each_with_index do |fsx_fs_id, index|
2426
fsx_shared_dir = fsx_shared_dir_array[index]
2527
fsx_dns_name = fsx_dns_name_array[index]
28+
fsx_fs_type = fsx_fs_type_array[index]
29+
fsx_volume_junction_path = fsx_volume_junction_path_array[index]
30+
2631
# Path needs to be fully qualified, for example "shared/temp" becomes "/shared/temp"
2732
fsx_shared_dir = "/#{fsx_shared_dir}" unless fsx_shared_dir.start_with?('/')
33+
fsx_volume_junction_path = "/#{fsx_volume_junction_path}" unless fsx_volume_junction_path.nil? || fsx_volume_junction_path.start_with?('/')
2834

2935
# Create the shared directories
3036
directory fsx_shared_dir do
@@ -36,31 +42,55 @@
3642
end
3743

3844
dns_name = if fsx_dns_name && !fsx_dns_name.empty?
45+
# DNS names of existing Lustre, Ontap, OpenZFS file systems are passed in from CLI
3946
fsx_dns_name
4047
else
41-
# Hardcoded DNSname only valid for filesystem created after Mar-1 2021
42-
# For older filesystems, DNSname needs to be retrieved from FSx API
48+
# DNS names of newly created Lustre file systems are hardcoded here.
49+
# Note the Hardcoding format is only valid for lustre file systems created after Mar-1 2021
4350
"#{fsx_fs_id}.fsx.#{node['cluster']['region']}.amazonaws.com"
4451
end
52+
case fsx_fs_type
53+
when 'LUSTRE'
54+
mount_name = fsx_mount_name_array[index]
55+
mount_options = %w(defaults _netdev flock user_xattr noatime noauto x-systemd.automount)
4556

46-
mount_name = fsx_mount_name_array[index]
47-
mount_options = %w(defaults _netdev flock user_xattr noatime)
48-
49-
mount_options.concat(%w(noauto x-systemd.automount))
50-
51-
# Mount FSx over NFS
52-
mount fsx_shared_dir do
53-
device "#{dns_name}@tcp:/#{mount_name}"
54-
fstype 'lustre'
55-
dump 0
56-
pass 0
57-
options mount_options
58-
action %i(mount enable)
59-
retries 10
60-
retry_delay 6
57+
mount fsx_shared_dir do
58+
device "#{dns_name}@tcp:/#{mount_name}"
59+
fstype 'lustre'
60+
dump 0
61+
pass 0
62+
options mount_options
63+
action %i(mount enable)
64+
retries 10
65+
retry_delay 6
66+
end
67+
when 'OPENZFS'
68+
mount fsx_shared_dir do
69+
device "#{dns_name}:#{fsx_volume_junction_path}"
70+
fstype 'nfs'
71+
dump 0
72+
pass 0
73+
options 'nfsvers=4.2'
74+
action %i(mount enable)
75+
retries 10
76+
retry_delay 6
77+
end
78+
when 'ONTAP'
79+
mount fsx_shared_dir do
80+
device "#{dns_name}:#{fsx_volume_junction_path}"
81+
fstype 'nfs'
82+
dump 0
83+
pass 0
84+
action %i(mount enable)
85+
retries 10
86+
retry_delay 6
87+
end
6188
end
6289

63-
# Make sure permission is correct
90+
next if fsx_fs_type == "OPENZFS"
91+
# Make sure permission is correct.
92+
# OpenZFS does not allow changing the permission of the root directory.
93+
# OpenZFS sets the directory permission to 1777 automatically.
6494
directory fsx_shared_dir do
6595
owner 'root'
6696
group 'root'

0 commit comments

Comments
 (0)