← Back to Pull requests

fix(util): invoke PodAllocationFailed on prepareMigAllocations failure #3391

Closed
unknown closed this pull request without merging on Nov 17, 2026 08:36 UTC
View on GitHub
unknown unknown commented on Nov 07, 2026 20:07 UTC
Author

What type of PR is this?

/kind bug

What this PR does / why we need it

In MIG mode, when "prepareMigAllocationsLocked()" fails (for example, when "findMigUUIDForGI()" cannot resolve a partition UUID due to transient NVML errors or unready partition states during discovery), "Allocate()" previously returned early without invoking "PodAllocationFailed".

Because the failure cleanup callback was bypassed, the node lock could remain held and the pending pod could remain stuck in "DeviceBindAllocating", potentially preventing subsequent allocation attempts on that node from progressing.

This PR fixes the failure-handling path by:

  • Moving "getPendingPod" above "prepareMigAllocationsLocked()" in "Allocate()" so the pending pod is resolved upfront and reused throughout the allocation flow.

  • Invoking "PodAllocationFailed(nodename, current, NodeLockNvidia)" when "prepareMigAllocationsLocked()" fails, ensuring the failed allocation follows the normal cleanup path, including pod state transition and node lock release.

  • Guarding "updatePodAnnotationsAndReleaseLock" against nil pods or empty node names to prevent nil pointer panics during failure handling.

  • Adding unit test coverage for the affected MIG allocation failure paths.
  • Which issue(s) this PR fixes

    Fixes #3386

    Does this PR introduce a user-facing change?

    No.

    Testing

  • Unit tests passed.

  • Compile checks passed.

  • Lint checks passed.

  • NVIDIA Tesla P4 E2E tests passed.

  • Benchmark checks passed.

  • CodeQL checks passed.

  • Codecov patch coverage: 100%.
  • AI Assistance Disclosure

    AI tools were used to assist with code analysis, implementation refinement, and review of potential edge cases. The implementation, validation, testing, and final changes were reviewed and verified by the contributor.

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    Failed dynamic MIG recovery now marks the pending pod’s allocation as failed before returning the recovery error.
    Allocation failure handling now avoids annotation updates and lock operations when pod or node information is missing, preventing errors in these cases.
    Allocation errors return an empty response when the pending pod cannot be found or its device annotations cannot be decoded.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 309 lines (+231 / -78) across 3 files Reviewer: blackdragoon26 Review duration: 13708m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 309 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.343
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3391"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.2% (MEDIUM) · Higher = larger blast radius
    40.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.9% · Safe to merge
    15.9%