-
Notifications
You must be signed in to change notification settings - Fork 57
OCPBUGS-43501: coreos-installer iso kargs show broken when using minimal ISO #463
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
base: main
Are you sure you want to change the base?
Conversation
def12db to
83daebe
Compare
|
@pawanpinjarkar: This pull request references Jira Issue OCPBUGS-43501, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@pawanpinjarkar: This pull request references Jira Issue OCPBUGS-43501, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/cherrypick release-4.19, release-4.18, release-4.17, release-4.16 |
|
@pawanpinjarkar: once the present PR merges, I will cherry-pick it on top of In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
carbonin
left a comment
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.
This is a bit strange. Generally I'm not sure why this is happening for only one of the boot configs, I don't know where the original offset numbers are coming from and it seems like there's a lot of unnecessary refactoring going on.
| } | ||
| offset := 1903 | ||
| if includeNmstateRamDisk { | ||
| offset = 1923 |
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.
Where is this number coming from?
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.
The offset was manually calculated during the dev work with the command such as dd if-isolinux.cfg bs=1 skip 1903 when the includeNmstateRamDisk was not included and it was coming to be 1923 when the includeNmstateRamDisk was included.
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.
Is this the same for every ISO version? I would expect this to vary.
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.
If we knew what the grub config file looked like in advance, we could just write the whole file out. We're doing all the replace stuff because we need to be robust against changes in coreos.
I think we need to count the number of characters we're adding/removing and where, then update the offsets/size as appropriate.
| } | ||
|
|
||
| func fixIsolinuxConfig(rootFSURL, extractDir string, includeNmstateRamDisk bool) error { | ||
| func fixIsolinuxConfig(rootFSURL, extractDir string, includeNmstateRamDisk bool) (string, error) { |
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.
Instead of returning the content as a side-effect, could we leave this unchanged then read the file we need after we call the original function?
| // Extract the line content after "append " | ||
| kernelArgs := strings.TrimPrefix(trimmed, "append ") | ||
| // Find " rw " (with spaces to avoid partial matches) | ||
| index := strings.Index(kernelArgs, " rw ") |
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.
No reason to think that rw will always be the first arg either.
…RUB and ISOLINUX config edits Replaced repetitive editFile logic with reusable helper functions: - `replace`: performs regex replacement and returns the updated content. - `saveFile`: writes content to file with secure permissions (0600). Updated `fixGrubConfig` and `fixIsolinuxConfig` to use these helpers for: - Adding coreos.live.rootfs_url - Removing coreos.liveiso - Modifying initrd lines with optional nmstate ramdisk This improves readability, testability, and maintainability of config mutation logic during ISO generation.
83daebe to
b761ad6
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pawanpinjarkar The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…port - Refactored fixIsolinuxConfig to return modified content for reuse. - Added fixKargsConfig to generate and update kargs.jso with correct kernel args and offset. - Introduced utility functions for extracting boot args and rebuilding kargs.jso. - Enhanced test coverage for both isolinux and kargs config logic. - Updated test data to reflect new kernel argument structure
b761ad6 to
cfab1e5
Compare
|
@pawanpinjarkar: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
Description
This PR enhances the way kernel arguments (kargs) are handled in RHCOS ISOs by updating both
isolinux.cfgandcoreos/kargs.jsofiles during minimal ISO generation.Key changes:
fixIsolinuxConfignow returns the modified config content for reuse instead of writing blindly to disk.Added
fixKargsConfig, which extracts the kernel args starting with rw fromisolinux.cfgand updates the embeddedcoreos/kargs.jsoJSON file with correct kernel arguments and offset values.Introduced helper functions
extractBootArgsandbuildKargsContentto support safe, consistent parsing and rewriting of kernel args.Updated test data to include sample
kargs.jso.Extended test coverage to validate both
isolinux.cfgandkargs.jsoupdates in cases with and without the nmstate disk image.This improves consistency across bootloaders (isolinux and grub), avoids stale
coreos.liveisoentries, and ensures correct injection of dynamic rootfs URLs and initrds, especially when including nmstate or other additional initrd images.How was this code tested?
Unit Tests: Added new tests in rhcos_test.go to validate that:
fixIsolinuxConfigcorrectly removescoreos.liveiso, addsrw, and appends appropriate initrd paths.fixKargsConfigcorrectly parses the kernel args fromisolinux.cfg, modifies thekargs.jsofile with correct offsets, and embeds updated args.Assignees
/cc @
/cc @
Links
Checklist
docs, README, etc)