Fix empty HypervisorID leak in resource provider listing#755
Conversation
…, auth, and locking Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…rvisorID Hypervisors that have not yet been registered with OpenStack have an empty Status.HypervisorID. HandleListResourceProviders fetches all hypervisors via s.List() without filtering these out, causing them to appear in the merged resource provider list with an empty UUID. This violates the Placement API contract and can confuse downstream clients. Other handlers (Show, Update, Delete, Create) use field-index lookups that naturally skip empty-ID hypervisors, so they are not affected. Filter out hypervisors with empty HypervisorID immediately after the List call, before any query-parameter filtering or merging. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Test Coverage ReportTest Coverage 📊: 70.0% |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe pull request updates placement API shim documentation with expanded coverage of authentication, authorization, distributed locking, and feature flags. Concurrently, the list resource provider handler filters out Kubernetes hypervisors lacking a non-empty Status.HypervisorID before merging results with upstream data. A test validates this filtering behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
Test PR for claude workflow. |
Summary
What the bug is
Hypervisors that have not yet been registered with OpenStack have an empty Status.HypervisorID. When HandleListResourceProviders merges Kubernetes hypervisors with upstream placement results, it includes these unregistered hypervisors, producing resource provider entries with empty UUIDs in the API response.
How it was found
Weekly review of recent changes (PR #724 introducing CRD-backed resource provider APIs).
What the fix does
Filters out hypervisors with empty HypervisorID immediately after the List call, before query-parameter filtering or merging with upstream results. Adds a test case covering this scenario.
Test plan
🤖 Generated with Claude Code