|
16 | 16 | # limitations under the License. |
17 | 17 |
|
18 | 18 | fsx_fs_id_array = node['cluster']['fsx_fs_ids'].split(',') |
| 19 | +fsx_fs_type_array = node['cluster']['fsx_fs_types'].split(',') |
19 | 20 | fsx_shared_dir_array = node['cluster']['fsx_shared_dirs'].split(',') |
20 | 21 | fsx_dns_name_array = node['cluster']['fsx_dns_names'].split(',') |
21 | 22 | fsx_mount_name_array = node['cluster']['fsx_mount_names'].split(',') |
| 23 | +fsx_volume_junction_path_array = node['cluster']['fsx_volume_junction_paths'].split(',') |
22 | 24 | # Check to see if FSx is created |
23 | 25 | fsx_fs_id_array.each_with_index do |fsx_fs_id, index| |
24 | 26 | fsx_shared_dir = fsx_shared_dir_array[index] |
25 | 27 | 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 | + |
26 | 31 | # Path needs to be fully qualified, for example "shared/temp" becomes "/shared/temp" |
27 | 32 | 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?('/') |
28 | 34 |
|
29 | 35 | # Create the shared directories |
30 | 36 | directory fsx_shared_dir do |
|
38 | 44 | dns_name = if fsx_dns_name && !fsx_dns_name.empty? |
39 | 45 | fsx_dns_name |
40 | 46 | 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 |
| 47 | + # Hardcoded DNS name only valid for lustre file systems created after Mar-1 2021 |
| 48 | + # For older file systems, DNS names need to be retrieved from FSx API |
| 49 | + # For Ontap and OpenZFS file systems, the DNS name is always passed from CLI. |
43 | 50 | "#{fsx_fs_id}.fsx.#{node['cluster']['region']}.amazonaws.com" |
44 | 51 | 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) |
45 | 56 |
|
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 |
61 | | - end |
| 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 |
62 | 67 |
|
63 | | - # Make sure permission is correct |
64 | | - directory fsx_shared_dir do |
65 | | - owner 'root' |
66 | | - group 'root' |
67 | | - mode '1777' |
| 68 | + # Make sure permission is correct |
| 69 | + directory fsx_shared_dir do |
| 70 | + owner 'root' |
| 71 | + group 'root' |
| 72 | + mode '1777' |
| 73 | + end |
| 74 | + when 'OPENZFS' |
| 75 | + mount fsx_shared_dir do |
| 76 | + device "#{dns_name}:#{fsx_volume_junction_path}" |
| 77 | + fstype 'nfs' |
| 78 | + dump 0 |
| 79 | + pass 0 |
| 80 | + options 'nfsvers=4.2' |
| 81 | + action %i(mount enable) |
| 82 | + retries 10 |
| 83 | + retry_delay 6 |
| 84 | + end |
| 85 | + when 'ONTAP' |
| 86 | + mount fsx_shared_dir do |
| 87 | + device "#{dns_name}:#{fsx_volume_junction_path}" |
| 88 | + fstype 'nfs' |
| 89 | + dump 0 |
| 90 | + pass 0 |
| 91 | + action %i(mount enable) |
| 92 | + retries 10 |
| 93 | + retry_delay 6 |
| 94 | + end |
| 95 | + # Make sure permission is correct |
| 96 | + directory fsx_shared_dir do |
| 97 | + owner 'root' |
| 98 | + group 'root' |
| 99 | + mode '1777' |
| 100 | + end |
68 | 101 | end |
69 | 102 | end |
0 commit comments