fix(util): preserve empty container slots in Ascend device index mapping - #122
fix(util): preserve empty container slots in Ascend device index mapping#122manoj-1407 wants to merge 1 commit into
Conversation
Ascend and Ascend310P device decoding silently skipped empty container
entries, breaking the index mapping for multi-container pods. When
container-0 has no Ascend device and container-1 does, the device was
mapped to container-0 instead.
Fix mirrors the existing NVIDIA/Hygon/MetaX pattern: check the container
count bound, and append an empty ContainerDevices{} for empty segments
to preserve the container-to-device index alignment.
Add TestDecodePodDevicesAscendMultiContainer to pin the correct behavior.
Signed-off-by: manoj-1407 <manojkumar148700@gmail.com>
|
@manoj-1407: The label(s) 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: manoj-1407 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @manoj-1407! It looks like this is your first PR to Project-HAMi/HAMi-WebUI 🎉 |
📝 WalkthroughWalkthroughAscend pod-device decoding now bounds annotation processing by container count, preserves empty container positions, skips empty segments, and retains error handling. A multi-container test verifies the new mapping behavior. ChangesAscend container decoding
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Thanks for identifying and testing the container-slot alignment bug. The same fix is now included in merged #95, together with multi-device-type aggregation coverage, so this PR is superseded. |
What type of PR is this?
/kind bug
Which issue(s) this PR fixes
Fixes #123
What this PR does
Ascend and Ascend310P device decoding silently skipped empty container entries, breaking the container-to-device index mapping for multi-container pods.
For a 2-container pod where container-0 has no Ascend device and container-1 does, the device was incorrectly mapped to container-0.
The Problem
NVIDIA, Hygon, and MetaX all correctly preserve empty slots. Ascend was the only device type missing this.
The Fix
Mirrors the existing pattern used by NVIDIA/Hygon/MetaX — check container count bound and append
ContainerDevices{}for empty segments.Testing
Added
TestDecodePodDevicesAscendMultiContainerwhich proves the correct index mapping is preserved. All existing tests pass.AI Disclosure
Used Claude for guidance. Did all implementation and testing myself. Understand the fix completely.
Summary by CodeRabbit
Bug Fixes
Tests