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

Update GRUB command line only if parameters change #27

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

priteau
Copy link
Member

@priteau priteau commented Mar 25, 2024

The grubcmdline role can be invoked like in the following example:

- name: Set iommu=pt
  include_role:
    name: stackhpc.linux.grubcmdline
  vars:
    kernel_cmdline:
      - iommu=pt kernel_cmdline_remove:
      - ^iommu=

When the role is called multiple times with parameters kernel_cmdline and kernel_cmdline_remove, each execution moves its kernel parameters at the end of the command line. This means each full execution would always update GRUB, even when the end result would be the same.

Fix by comparing the existing command line with the newly generated one as sets and only updating GRUB_CMDLINE_LINUX_DEFAULT if they are different.

The grubcmdline role can be invoked like in the following example:

    - name: Set iommu=pt
      include_role:
        name: stackhpc.linux.grubcmdline
      vars:
        kernel_cmdline:
          - iommu=pt
        kernel_cmdline_remove:
          - ^iommu=

When the role is called multiple times with parameters kernel_cmdline
and kernel_cmdline_remove, each execution moves its kernel parameters at
the end of the command line. This means each full execution would always
update GRUB, even when the end result would be the same.

Fix by comparing the existing command line with the newly generated one
as sets and only updating GRUB_CMDLINE_LINUX_DEFAULT if they are
different.
@priteau priteau self-assigned this Mar 25, 2024
@priteau priteau requested a review from a team as a code owner March 25, 2024 21:56
@markgoddard markgoddard merged commit 8a81227 into main Mar 26, 2024
4 checks passed
@markgoddard markgoddard deleted the grub-cmdline-fix-update branch March 26, 2024 09:47
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.

2 participants