OCPBUGS-57309: '0 B' is shown on details page when create pvc with 'EiB' unit#16800
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@cajieh: This pull request references Jira Issue OCPBUGS-57309, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. 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. |
WalkthroughAdds support for the largest binary memory unit, exbibyte ( ChangesExbibyte unit support
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
1301dbd to
47c45aa
Compare
| }); | ||
| if (startingUnitIndex <= 0) { | ||
| // 0 is valid: reversed unit list puts the largest suffix first (e.g. "1Ei" → Ei at index 0); -1 means no match. | ||
| if (startingUnitIndex < 0) { |
There was a problem hiding this comment.
The index 0 is a successful match at the first position—not a failure. Unit parsing searches a reversed copy of the unit list (largest suffix first), so values like "1Ei" match Ei at index 0.
47c45aa to
9d57418
Compare
|
/jira refresh |
|
@cajieh: This pull request references Jira Issue OCPBUGS-57309, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (yapei@redhat.com), skipping review request. 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. |
|
/approve |
|
Scheduling tests matching the |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cajieh, rhamilto 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 |
|
/test e2e-playwright |
1 similar comment
|
/test e2e-playwright |
|
verified by CI |
|
/verified by CI |
|
/retest |
|
@cajieh: This PR has been marked as verified by 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. |
38882a3
into
openshift:main
|
@cajieh: Jira Issue Verification Checks: Jira Issue OCPBUGS-57309 Jira Issue OCPBUGS-57309 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓 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. |
|
/cherry-pick release-4.22 |
|
@cajieh: new pull request created: #16806 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 kubernetes-sigs/prow repository. |
|
@cajieh: new pull request created: #16807 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 kubernetes-sigs/prow repository. |


Analysis / Root cause:
Creating a PVC with size unit EiB stores
spec.resources.requests.storageas1Ei(same asoc get pvc -ojson). On the details page, Requested capacity usesconvertToBaseValue→humanizeBinaryBytes.convertToBaseValuedehumanizes via a reversed unit list whereEiis index0. The parser treatedstartingUnitIndex <= 0as failure, so"1Ei"never converted to bytes andhumanizeBinaryBytesfell back to0 B. Separately,binaryByteshad noEiBunit, so even a correct byte value could not humanize to exbibytes.Solution description:
In
frontend/public/components/utils/units.js:startingUnitIndex < 0as unparseable so the largest unit (Ei, and similarly other type maxima) can be dehumanized.EiBtobinaryBytesso values ≥ 1 Ei humanize asN EiB.EitovalidMemUnitsso memory validation accepts1Ei.Unit tests in
units.spec.jscover humanize/dehumanize/convertToBaseValue/validate.memoryfor1Ei.Ei remains available in the PVC create dropdown; API/
ocquantity stays1Ei. UI displays the equivalent humanized value1 EiB(console binary label convention), not the raw k8s string.Screenshots / screen recording:
Before:

After

Test setup:
OpenShift cluster with console built from this branch. Ability to create a PVC (any StorageClass that accepts the request, or create via YAML if provisioner rejects Ei).
Test cases:
1and unitEiB; confirm YAML/ocshowsstorage: 1Ei.1 EiB(not0 B).requests.storage: 1Ei; details page still shows1 EiB.1Gi/1Pistill shows1 GiB/1 PiB.yarn test public/components/__tests__/units.spec.jsBrowser conformance:
Additional info:
fractional byte value "1Ei" is invalidare API/cluster policy behavior and are out of scope for this UI fix.1 EiB; it is intentionally not a raw mirror of theocstring1Ei.1Ei(fractional byte value "1Ei" is invalid) and the console may show that as an Admission Webhook toast. This is a known KubernetesQuantity/MilliValueoverflow quirk (kubernetes#128684); the same warning appears withoc.Summary by CodeRabbit
1 EiB/1 Ei.1 Ei.