-
Notifications
You must be signed in to change notification settings - Fork 57
CNV-79748: Fix null metadata crash in SCSI persistent reservation settings #3467
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?
CNV-79748: Fix null metadata crash in SCSI persistent reservation settings #3467
Conversation
…tings Add null guard for hyperConverge before calling k8sPatch and disable the switch when HyperConverged resource is not available to prevent "Cannot read properties of null (reading 'metadata')" error. Co-authored-by: Cursor <[email protected]>
|
@upalatucci: This pull request references CNV-79748 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.22.0" version, but no target version was set. DetailsIn 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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: upalatucci The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughAdded defensive null checks to the PersistentReservationSection component. An early return guard was introduced in the onChange handler, and the disabled state condition was extended to verify hyperConverge is truthy before proceeding with state updates. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@upalatucci: This pull request references CNV-79748 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.22.0" version, but no target version was set. DetailsIn 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. |
📝 Description
Fixes a crash in the SCSI persistent reservation section of the Virtualization Settings page (Cluster tab).
The error
Cannot read properties of null (reading 'metadata')occurs becausehyperConvergecan benulleven after loading completes (e.g., when the HyperConverged resource list is empty). When the switch is toggled,onChangepasses the null resource tok8sPatch, which tries to accessresource.metadata.namespaceand crashes.Changes:
if (!hyperConverge) return) in theonChangehandler to prevent callingk8sPatchwith a null resourcehyperConvergeis null (isDisabled={!hyperLoaded || !hyperConverge}) so it cannot be toggled without a valid resourceJira: https://issues.redhat.com/browse/CNV-79748
🎥 Demo
Before: Error banner shown in the SCSI persistent reservation section — "Cannot read properties of null (reading 'metadata')"
After: Switch is properly disabled when HyperConverged resource is unavailable, no crash
Made with Cursor
Summary by CodeRabbit