Skip to content

Commit 95d13d7

Browse files
Improve RAID logic
`raid_parameters` is splitted into `raid_shared_dir` and `raid_type` Remove reliance on NONE. Now, an empty string means no storage. This change will make it easier if we want to support multiple RAIDs in the future Signed-off-by: Hanwen <[email protected]>
1 parent 480f9b1 commit 95d13d7

File tree

5 files changed

+13
-17
lines changed

5 files changed

+13
-17
lines changed

attributes/default.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@
477477
default['cluster']['node_type'] = nil
478478
default['cluster']['cluster_user'] = 'ec2-user'
479479
default['cluster']['head_node_private_ip'] = nil
480-
default['cluster']['volume'] = nil
480+
default['cluster']['volume'] = ""
481481

482482
# ParallelCluster internal variables to configure active directory service
483483
default['cluster']["directory_service"]["enabled"] = 'false'
@@ -510,8 +510,9 @@
510510
default['cluster']['fsx_mount_names'] = ''
511511
default['cluster']['custom_node_package'] = nil
512512
default['cluster']['custom_awsbatchcli_package'] = nil
513-
default['cluster']['raid_parameters'] = 'NONE'
514-
default['cluster']['raid_vol_ids'] = nil
513+
default['cluster']['raid_shared_dir'] = ''
514+
default['cluster']['raid_type'] = ''
515+
default['cluster']['raid_vol_ids'] = ''
515516
default['cluster']['dns_domain'] = nil
516517
default['cluster']['use_private_hostname'] = 'false'
517518
default['cluster']['add_node_hostnames_in_hosts_file'] = node['cluster']['use_private_hostname']

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
# limitations under the License.
1717

1818
# Parse and get RAID shared directory info and turn into an array
19-
raid_shared_dir = node['cluster']['raid_parameters'].split(',')[0]
19+
raid_shared_dir = node['cluster']['raid_shared_dir']
2020

21-
if raid_shared_dir != "NONE"
21+
unless raid_shared_dir.empty?
2222
# Path needs to be fully qualified, for example "shared/temp" becomes "/shared/temp"
2323
raid_shared_dir = "/#{raid_shared_dir}" unless raid_shared_dir.start_with?('/')
2424

@@ -67,8 +67,6 @@
6767
shared_dir_array.each do |dir|
6868
dirname = dir.strip
6969

70-
next if dirname == "NONE"
71-
7270
dirname = "/#{dirname}" unless dirname.start_with?('/')
7371

7472
# Created shared mount point

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
dev_uuids = [] # device uuids
3434

3535
vol_array.each_with_index do |volumeid, index|
36-
# Skips volume if shared_dir is /NONE
37-
next if shared_dir_array[index] == "/NONE"
38-
3936
dev_path[index] = "/dev/disk/by-ebs-volumeid/#{volumeid}"
4037

4138
# Attach EBS volume

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
# RAID RELATED
1919
# Parse and get RAID shared directory info and turn into an array
20-
raid_shared_dir = node['cluster']['raid_parameters'].split(',')[0]
20+
raid_shared_dir = node['cluster']['raid_shared_dir']
2121

22-
if raid_shared_dir != "NONE"
22+
unless raid_shared_dir.empty?
2323
# Path needs to be fully qualified, for example "shared/temp" becomes "/shared/temp"
2424
raid_shared_dir = "/#{raid_shared_dir}" unless raid_shared_dir.start_with?('/')
2525

2626
# Parse and determine RAID type (cast into integer)
27-
raid_type = node['cluster']['raid_parameters'].split(',')[1].strip.to_i
27+
raid_type = node['cluster']['raid_type'].strip.to_i
2828

2929
# Parse volume info into an array
3030
raid_vol_array = node['cluster']['raid_vol_ids'].split(',')

system_tests/dna.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"cluster": {
33
"stack_name": "pc3cluster",
4-
"raid_vol_ids": "NONE",
5-
"raid_parameters": "NONE,NONE,NONE,NONE,NONE,NONE,NONE,NONE,NONE",
4+
"raid_vol_ids": "",
5+
"raid_shared_dir": "",
66
"disable_hyperthreading_manually": "false",
77
"base_os": "ubuntu2004",
88
"preinstall": "NONE",
@@ -16,10 +16,10 @@
1616
"fsx_mount_names": "",
1717
"fsx_dns_names": "",
1818
"fsx_shared_dirs": "",
19-
"volume": "NONE",
19+
"volume": "",
2020
"scheduler": "slurm",
2121
"ephemeral_dir": "/scratch",
22-
"ebs_shared_dirs": "NONE,NONE,NONE,NONE,NONE",
22+
"ebs_shared_dirs": "",
2323
"proxy": "NONE",
2424
"dns_domain": "pc3cluster.pcluster.",
2525
"hosted_zone": "Z0000000000000000000",

0 commit comments

Comments
 (0)