Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty list items #17

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

jjo93sa
Copy link
Contributor

@jjo93sa jjo93sa commented Jan 22, 2024

Add select() filter to the creation of grub_cmdline_linux_new removes empty list elements, which might exist in kernal_cmdline as a result of defaults, For example, consider the list:

kernel_cmdline:
  - processor.max_cstate=1
  - intel_idle.max_cstate=0
  - default_hugepagesz={{ controllers_perf_tuning_default_hugepagesz }}
  -  hugepagesz={{ controllers_perf_tuning_hugepagesz }}
  - hugepages={{ controllers_perf_tuning_hugepages }}
  - transparent_hugepage={{ controllers_perf_tuning_transparent_hugepage }}
  - "{{ vendor_iommu_setting }}"
  - iommu=pt
  - "{{ pcie_aspm_setting | default(None) }}"
  - "{{ rcu_nocbs_setting | default(None) }}"

This results in:

grub_cmdline_linux_new:
  - console=tty0
  - console=ttyS0,115200
  - no_timer_check
  - nofb
  - nomodeset
  - gfxpayload=text
  - net.ifnames=1
  - processor.max_cstate=1
  - intel_idle.max_cstate=0
  - default_hugepagesz=1G
  - hugepagesz=1G
  - hugepages=512
  - transparent_hugepage=always
  - intel_iommu=on
  - iommu=pt
  - ''
  - ''

And, when those empty list elements are appended to the string, two additional white spaces are added to the end of the string. This can break idempotency of the role.

grub_cmdline_linux_new: 'console=tty0 console=ttyS0,115200 no_timer_check nofb nomodeset gfxpayload=text net.ifnames=1 processor.max_cstate=1 intel_idle.max_cstate=0 default_hugepagesz=1G hugepagesz=1G hugepages=512 transparent_hugepage=always intel_iommu=on iommu=pt  ' # notice the spaces between "t" and the closing quote

Add `select()` filter to the creation of `grub_cmdline_linux_new`
removes empty list elements, which for example might exist in
`kernal_cmdline` as a result of defaults.
@jjo93sa jjo93sa requested a review from a team as a code owner January 22, 2024 14:04
@jjo93sa jjo93sa changed the title Handle emptry list items Handle empty list items Jan 22, 2024
roles/grubcmdline/tasks/main.yml Outdated Show resolved Hide resolved
roles/grubcmdline/tasks/main.yml Outdated Show resolved Hide resolved
Copy link
Member

@markgoddard markgoddard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@markgoddard markgoddard merged commit ccba8be into stackhpc:main Jan 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants