-
Notifications
You must be signed in to change notification settings - Fork 68
Use grubby to update kernel command line arguments #511
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
Open
mihaelabalutoiu
wants to merge
1
commit into
cloudbase:master
Choose a base branch
from
mihaelabalutoiu:add-grubby-kernel-opts
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that both grub update and grubby are being called. It should be the one or the other, not both.
An ideal implementation would be to call for
_update_kernel_cmdline_argsindeed, but you only implemented it for redhat based. There should also be a debian implementation which does the former (reads /etc/default/grub, removes/adds/edits the cmdline, schedules grub2 update).I propose the following:
Use Grub2ConfigEditor whenever possible instead of
sed-ing the file directly.This implies implementing a new method to remove cmdline entries, call it
remove_from_optionThis method should pretty much emulate what grubby does on redhat, and that is if you pass a single option
(
--remove-args=cloud-init), then it will be removed even if it's a key_val, no matter what value cloud-init hasin cmdline. If you pass a key_val, then only remove the key if the value matches
(
--remove-args=cloud-init=disabledonly remove cloud-init from cmdline if it's disabled, but won'tremove
cloud-init=enabled).We should somehow abstractize this for redhat. On base, when calling for
_update_kernel_cmdline_args,it should instantiate a Grub2ConfigEditor, append or remove from GRUB_CMDLINE_LINUX and
GRUB_CMDLINE_LINUX_DEFAULT options (depending on what args_to_add or args_to_remove are being
passed).
If it's redhat, then simply use grubby to handle args_to_add/args_to_remove
(only if grubby commands take too long, otherwise treat this as optional) I think the final grubby command should also be run once at the end, so add some
schedule_grubbymethods as well when adding args to remove/add. (similar to
_schedule_grub2_update)