Skip to content

Commit cc405a8

Browse files
yuleiwanlukeseawalker
authored andcommitted
Switch to multi_user.target runlevel only for official ami build (#845)
* Switch to user_multi.target runlevel only for official ami build Signed-off-by: Yulei Wang <[email protected]> Co-authored-by: Luca Carrogu <[email protected]>
1 parent f5b5e69 commit cc405a8

File tree

10 files changed

+17
-6
lines changed

10 files changed

+17
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This file is used to list changes made in each version of the AWS ParallelCluste
99
**ENHANCEMENTS**
1010
- Configure NFS threads to be max(8, num_cores) for performance. This enhancement will not take effect on Ubuntu 16.04 unless the instance is rebooted.
1111
- EFA kernel module now installed also on ARM instances with `alinux2` and `ubuntu1804`
12-
- Set default systemd runlevel to multi-user.target on all OSes during ami creation. The runlevel is set to graphical.target only when DCV is enabled.
12+
- Set default systemd runlevel to multi-user.target on all OSes during ParallelCluster official ami creation. The runlevel is set to graphical.target on head node only when DCV is enabled.
1313

1414
**CHANGES**
1515
- Upgrade EFA installer to version 1.11.0

amis/packer_alinux.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@
226226
"nvidia" : {
227227
"enabled" : "{{user `nvidia_enabled`}}"
228228
},
229+
"is_official_ami_build": "true",
229230
"custom_node_package" : "{{user `custom_node_package`}}",
230231
"cfn_base_os" : "alinux"
231232
}

amis/packer_alinux2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@
226226
"nvidia" : {
227227
"enabled" : "{{user `nvidia_enabled`}}"
228228
},
229+
"is_official_ami_build": "true",
229230
"custom_node_package" : "{{user `custom_node_package`}}",
230231
"cfn_base_os" : "alinux2"
231232
}

amis/packer_centos7.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
"dcv": {
246246
"installed" : "{{user `dcv_installed`}}"
247247
},
248+
"is_official_ami_build": "true",
248249
"custom_node_package" : "{{user `custom_node_package`}}",
249250
"cfn_base_os" : "centos7"
250251
}

amis/packer_centos8.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@
241241
"nvidia" : {
242242
"enabled" : "{{user `nvidia_enabled`}}"
243243
},
244+
"is_official_ami_build": "true",
244245
"dcv": {
245246
"installed" : "{{user `dcv_installed`}}"
246247
},

amis/packer_ubuntu1604.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@
247247
"nvidia" : {
248248
"enabled" : "{{user `nvidia_enabled`}}"
249249
},
250+
"is_official_ami_build": "true",
250251
"custom_node_package" : "{{user `custom_node_package`}}",
251252
"cfn_base_os" : "ubuntu1604"
252253
}

amis/packer_ubuntu1804.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@
251251
"dcv": {
252252
"installed" : "{{user `dcv_installed`}}"
253253
},
254+
"is_official_ami_build": "true",
254255
"custom_node_package" : "{{user `custom_node_package`}}",
255256
"cfn_base_os" : "ubuntu1804"
256257
}

attributes/default.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,3 +437,6 @@
437437

438438
# AWS domain
439439
default['cfncluster']['aws_domain'] = aws_domain
440+
441+
# Official ami build
442+
default['cfncluster']['is_official_ami_build'] = false

recipes/dcv_install.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,11 @@ def disable_lock_screen
229229
end
230230
end
231231

232-
# Switch runlevel to multi-user.target
233-
if node['init_package'] == 'systemd'
234-
execute "set default systemd runlevel to multi-user.target" do
235-
command "systemctl set-default multi-user.target"
232+
# Switch runlevel to multi-user.target for official ami
233+
if node['cfncluster']['is_official_ami_build']
234+
if node['init_package'] == 'systemd'
235+
execute "set default systemd runlevel to multi-user.target" do
236+
command "systemctl set-default multi-user.target"
237+
end
236238
end
237239
end

recipes/tests.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@
259259
command "systemctl show -p SubState gdm | grep -i running"
260260
end
261261
end
262-
elsif node['init_package'] == 'systemd'
262+
elsif node['init_package'] == 'systemd' && node['conditions']['ami_bootstrapped']
263263
execute 'check systemd default runlevel' do
264264
command "systemctl get-default | grep -i multi-user.target"
265265
end

0 commit comments

Comments
 (0)