-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Develop] Add support for an external shared /home
Users can now specify `/home` as a mount point in SharedStorage. This was previously a reserved directory When a user specifies this, the data in `/home` is transferred without replacement to the external filesystem. This means that in order to share the `/home` directory across clusters, users must specify the same security credentials when creating the clusters.
- Loading branch information
1 parent
1fc1e2c
commit 991c15b
Showing
9 changed files
with
230 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
cookbooks/aws-parallelcluster-environment/recipes/config/fsx.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the | ||
# License. A copy of the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES | ||
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
return if on_docker? | ||
id_array = node['cluster']['fsx_fs_ids'].split(',') | ||
type_array = node['cluster']['fsx_fs_types'].split(',') | ||
shared_dir_array = node['cluster']['fsx_shared_dirs'].split(',') | ||
dns_name_array = node['cluster']['fsx_dns_names'].split(',') | ||
mount_name_array = node['cluster']['fsx_mount_names'].split(',') | ||
volume_junction_path_array = node['cluster']['fsx_volume_junction_paths'].split(',') | ||
|
||
# Identify the previously mounted filesystems and remove them from the set of filesystems to mount | ||
shared_dir_array.each_with_index do |dir, index| | ||
next unless dir == "/home" | ||
id_array.delete_at(index) | ||
type_array.delete_at(index) | ||
shared_dir_array.delete(dir) | ||
dns_name_array.delete_at(index) | ||
mount_name_array.delete_at(index) | ||
volume_junction_path_array.delete_at(index) | ||
end | ||
|
||
# Mount FSx shared directories with the lustre resource | ||
lustre "mount fsx" do | ||
fsx_fs_id_array id_array | ||
fsx_fs_type_array type_array | ||
fsx_shared_dir_array shared_dir_array | ||
fsx_dns_name_array dns_name_array | ||
fsx_mount_name_array mount_name_array | ||
fsx_volume_junction_path_array volume_junction_path_array | ||
action :mount | ||
not_if { id_array.empty? } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
cookbooks/aws-parallelcluster-environment/recipes/init/backup_home_shared_data.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
# | ||
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the | ||
# License. A copy of the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES | ||
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
return if on_docker? | ||
|
||
if node['cluster']['node_type'] == 'HeadNode' | ||
# For each, backup the data to a temp location | ||
# This is necessary to preserve any data in these directories that was | ||
# generated during the build of ParallelCluster AMIs after converting to | ||
# shared storage | ||
bash "Backup /home" do | ||
user 'root' | ||
group 'root' | ||
code <<-EOH | ||
mkdir -p /tmp/home | ||
rsync -a /home/ /tmp/home | ||
EOH | ||
end | ||
end |
31 changes: 31 additions & 0 deletions
31
cookbooks/aws-parallelcluster-environment/recipes/init/restore_home_shared_data.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
# | ||
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the | ||
# License. A copy of the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES | ||
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
return if on_docker? | ||
|
||
if node['cluster']['node_type'] == 'HeadNode' | ||
# Restore the shared storage home data if it doesn't already exist | ||
# This is necessary to preserve any data in these directories that was | ||
# generated during the build of ParallelCluster AMIs after converting to | ||
# shared storage and backed up to a temporary location previously | ||
# Remove the backup after the copy is done | ||
bash "Restore /home" do | ||
user 'root' | ||
group 'root' | ||
code <<-EOH | ||
rsync -a --ignore-existing /tmp/home/ /home | ||
rm -rf /tmp/home/ | ||
EOH | ||
end | ||
end |