Follow node vNPU mode for pods without vnpu-mode annotation#106
Follow node vNPU mode for pods without vnpu-mode annotation#106ouyangluwei163 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe device plugin now resolves allocation mode for annotation-less pods from the node’s ChangesMode-agnostic vNPU resolution
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
cdd7076 to
2a02ef3
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/server/util_test.go`:
- Around line 449-465: The hami-core allocation test expectation is missing the
per-container shared-memory mount, so the mount count assertion will fail.
Update the `buildContainerAllocateResponseWant` setup in
`internal/server/util_test.go` for this case to include the extra mount appended
by the `HamiCoreMode_Mounts` path (the per-container `hostHookPath +
"/containers/_"` shmem dir) so `resp.Mounts` matches `tc.want.mounts`. Keep the
existing `mounts` slice in sync with the behavior exercised by
`buildContainerAllocateResponse` and `HamiCoreMode_Mounts`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9d95ce2f-6c0b-46bc-b45e-bf15bfcadc18
📒 Files selected for processing (3)
README.mdinternal/server/allocate.gointernal/server/util_test.go
| want: buildContainerAllocateResponseWant{ | ||
| envs: map[string]string{ | ||
| "ASCEND_VISIBLE_DEVICES": "3", | ||
| "NPU_MEM_QUOTA": "8738", | ||
| "NPU_PRIORITY": "4", | ||
| "NPU_GLOBAL_SHM_PATH": "/hami-shared-region/3_global_registry", | ||
| }, | ||
| mounts: []*v1beta1.Mount{ | ||
| {HostPath: "/usr/local/bin/npu-smi", ContainerPath: "/usr/local/bin/npu-smi", ReadOnly: true}, | ||
| {HostPath: "/etc/ascend_install.info", ContainerPath: "/etc/ascend_install.info", ReadOnly: true}, | ||
| {HostPath: "/usr/local/Ascend/driver/lib64/driver", ContainerPath: "/usr/local/Ascend/driver/lib64/driver", ReadOnly: true}, | ||
| {HostPath: "/usr/local/Ascend/driver/version.info", ContainerPath: "/usr/local/Ascend/driver/version.info", ReadOnly: true}, | ||
| {HostPath: "/usr/local/hami-vnpu-core", ContainerPath: "/hami-vnpu-core", ReadOnly: true}, | ||
| {HostPath: "/usr/local/hami-vnpu-core/ld.so.preload", ContainerPath: "/etc/ld.so.preload", ReadOnly: true}, | ||
| {HostPath: "/usr/local/hami-shared-region", ContainerPath: "/hami-shared-region", ReadOnly: false}, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Missing mount entry — test will fail.
want.mounts lists only 7 entries, but the hami-core branch always appends an 8th mount for the per-container shmem dir (hostHookPath + "/containers/_", per the existing HamiCoreMode_Mounts case). The len(resp.Mounts) != len(tc.want.mounts) check will fail this subtest.
🐛 Proposed fix
mounts: []*v1beta1.Mount{
{HostPath: "/usr/local/bin/npu-smi", ContainerPath: "/usr/local/bin/npu-smi", ReadOnly: true},
{HostPath: "/etc/ascend_install.info", ContainerPath: "/etc/ascend_install.info", ReadOnly: true},
{HostPath: "/usr/local/Ascend/driver/lib64/driver", ContainerPath: "/usr/local/Ascend/driver/lib64/driver", ReadOnly: true},
{HostPath: "/usr/local/Ascend/driver/version.info", ContainerPath: "/usr/local/Ascend/driver/version.info", ReadOnly: true},
{HostPath: "/usr/local/hami-vnpu-core", ContainerPath: "/hami-vnpu-core", ReadOnly: true},
{HostPath: "/usr/local/hami-vnpu-core/ld.so.preload", ContainerPath: "/etc/ld.so.preload", ReadOnly: true},
{HostPath: "/usr/local/hami-shared-region", ContainerPath: "/hami-shared-region", ReadOnly: false},
+ {HostPath: hostHookPath + "/containers/_", ContainerPath: "/hami-vnpu-shmem", ReadOnly: false},
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| want: buildContainerAllocateResponseWant{ | |
| envs: map[string]string{ | |
| "ASCEND_VISIBLE_DEVICES": "3", | |
| "NPU_MEM_QUOTA": "8738", | |
| "NPU_PRIORITY": "4", | |
| "NPU_GLOBAL_SHM_PATH": "/hami-shared-region/3_global_registry", | |
| }, | |
| mounts: []*v1beta1.Mount{ | |
| {HostPath: "/usr/local/bin/npu-smi", ContainerPath: "/usr/local/bin/npu-smi", ReadOnly: true}, | |
| {HostPath: "/etc/ascend_install.info", ContainerPath: "/etc/ascend_install.info", ReadOnly: true}, | |
| {HostPath: "/usr/local/Ascend/driver/lib64/driver", ContainerPath: "/usr/local/Ascend/driver/lib64/driver", ReadOnly: true}, | |
| {HostPath: "/usr/local/Ascend/driver/version.info", ContainerPath: "/usr/local/Ascend/driver/version.info", ReadOnly: true}, | |
| {HostPath: "/usr/local/hami-vnpu-core", ContainerPath: "/hami-vnpu-core", ReadOnly: true}, | |
| {HostPath: "/usr/local/hami-vnpu-core/ld.so.preload", ContainerPath: "/etc/ld.so.preload", ReadOnly: true}, | |
| {HostPath: "/usr/local/hami-shared-region", ContainerPath: "/hami-shared-region", ReadOnly: false}, | |
| }, | |
| }, | |
| want: buildContainerAllocateResponseWant{ | |
| envs: map[string]string{ | |
| "ASCEND_VISIBLE_DEVICES": "3", | |
| "NPU_MEM_QUOTA": "8738", | |
| "NPU_PRIORITY": "4", | |
| "NPU_GLOBAL_SHM_PATH": "/hami-shared-region/3_global_registry", | |
| }, | |
| mounts: []*v1beta1.Mount{ | |
| {HostPath: "/usr/local/bin/npu-smi", ContainerPath: "/usr/local/bin/npu-smi", ReadOnly: true}, | |
| {HostPath: "/etc/ascend_install.info", ContainerPath: "/etc/ascend_install.info", ReadOnly: true}, | |
| {HostPath: "/usr/local/Ascend/driver/lib64/driver", ContainerPath: "/usr/local/Ascend/driver/lib64/driver", ReadOnly: true}, | |
| {HostPath: "/usr/local/Ascend/driver/version.info", ContainerPath: "/usr/local/Ascend/driver/version.info", ReadOnly: true}, | |
| {HostPath: "/usr/local/hami-vnpu-core", ContainerPath: "/hami-vnpu-core", ReadOnly: true}, | |
| {HostPath: "/usr/local/hami-vnpu-core/ld.so.preload", ContainerPath: "/etc/ld.so.preload", ReadOnly: true}, | |
| {HostPath: "/usr/local/hami-shared-region", ContainerPath: "/hami-shared-region", ReadOnly: false}, | |
| {HostPath: hostHookPath + "/containers/_", ContainerPath: "/hami-vnpu-shmem", ReadOnly: false}, | |
| }, | |
| }, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/server/util_test.go` around lines 449 - 465, The hami-core
allocation test expectation is missing the per-container shared-memory mount, so
the mount count assertion will fail. Update the
`buildContainerAllocateResponseWant` setup in `internal/server/util_test.go` for
this case to include the extra mount appended by the `HamiCoreMode_Mounts` path
(the per-container `hostHookPath + "/containers/_"` shmem dir) so `resp.Mounts`
matches `tc.want.mounts`. Keep the existing `mounts` slice in sync with the
behavior exercised by `buildContainerAllocateResponse` and
`HamiCoreMode_Mounts`.
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: ouyangluwei163 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 |
Signed-off-by: ouyangluwei(riseunion) <ouyangluwei@riseunion.io>
Signed-off-by: ouyangluwei(riseunion) <ouyangluwei@riseunion.io>
2a02ef3 to
f8848b2
Compare
|
New changes are detected. LGTM label has been removed. |
|
LGTM on the logic. Please fix the test case as @DSFans2014 and CodeRabbit pointed out — the |
HAMi: Project-HAMi/HAMi#2034
fix: #105
Summary by CodeRabbit
huawei.com/vnpu-mode: hami-corealways use soft slicing and schedule only to compatible nodes; pods without the annotation follow the node’s capabilities.VNPUModeannotation correctly follow the node’s HAMi-core vs template behavior.