2 heat_template_version: 2014-10-16
5 This is an example showing how you can do firstboot configuration
6 of the nodes via cloud-init. To enable this, replace the default
7 mapping of OS::TripleO::NodeUserData in ../overcloud_resource_registry*
12 Space seprated list of Kernel args to be update to grub.
13 The given args will be appended to existing args of
14 GRUB_CMDLINE_LINUX in file /etc/default/grub
16 "intel_iommu=on default_hugepagesz=2MB hugepagesz=2MB hugepages=2048"
21 Name of the kvmfornfv kernel rpm.
22 Example: "kvmfornfv_kernel.rpm"
25 ComputeHostnameFormat:
31 type: OS::Heat::MultipartMime
34 - config: {get_resource: compute_kernel_args}
36 # Verify the logs on /var/log/cloud-init.log on the overcloud node
38 type: OS::Heat::SoftwareConfig
47 if [ -n "$KERNEL_ARGS" ]; then
48 sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS"/g' \
49 -i /etc/default/grub ;
50 grub2-mkconfig -o /etc/grub2.cfg
51 hugepage_count=$(echo $KERNEL_ARGS | \
52 grep -oP ' ?hugepages=\K[0-9]+')
53 if [ -z "$hugepage_count" ]; then
56 echo vm.hugetlb_shm_group=0 >> /usr/lib/sysctl.d/00-system.conf
57 HPAGE_CT=$(printf "%.0f" $(echo 2.2*$hugepage_count | bc))
58 echo vm.max_map_count=$HPAGE_CT >> \
59 /usr/lib/sysctl.d/00-system.conf
60 HPAGE_CT=$(($hugepage_count * 2 * 1024 * 1024))
61 echo kernel.shmmax=$HPAGE_CT >> /usr/lib/sysctl.d/00-system.conf
65 if [ -n "$KVMFORNFV_KERNEL_RPM" ]; then
66 FORMAT=$COMPUTE_HOSTNAME_FORMAT
67 if [[ -z $FORMAT ]] ; then
70 # Assumption: only %index% and %stackname% are
71 # the variables in Host name format
72 FORMAT=$(echo $FORMAT | sed 's/\%index\%//g');
73 FORMAT=$(echo $FORMAT | sed 's/\%stackname\%//g');
75 if [[ $(hostname) == *$FORMAT* ]] ; then
76 yum install -y /root/$KVMFORNFV_KERNEL_RPM
77 grub2-mkconfig -o /etc/grub2.cfg
83 if [ "$need_reboot" == "true" ]; then
87 $KERNEL_ARGS: {get_param: ComputeKernelArgs}
88 $KVMFORNFV_KERNEL_RPM: {get_param: KVMForNFVKernelRPM}
89 $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat}
93 value: {get_resource: userdata}