feat(dhcp): suppress DHCP for ignored BMC MAC addresses - #4459
Conversation
Summary by CodeRabbit
Walkthrough
ChangesDHCP suppression handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
461129c to
750d4b2
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@crates/api-core/src/dhcp/discover.rs`:
- Around line 502-504: Update the error message in the DHCP suppression path to
use lowercase wording while preserving the interpolated parsed_mac value and
omitting any trailing period. Keep the existing CarbideError::FailedPrecondition
construction unchanged.
- Around line 494-499: Update the cached-response path in
Controller::discover_dhcp to check BMC suppression before returning an unexpired
cached record, ensuring suppressed MAC addresses reach the suppression
acknowledgment flow and do not receive stale cached DHCP responses.
Alternatively, invalidate every cache key for parsed_mac when
db::bmc_suppression::acknowledge begins suppression, while preserving normal
caching for unsuppressed MAC addresses.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 65de907a-6810-488e-9e19-2a26ffa84941
📒 Files selected for processing (1)
crates/api-core/src/dhcp/discover.rs
ericpretzel
left a comment
There was a problem hiding this comment.
For decommissioning, we will reset the BMC which should cause it to go back to dhcpdiscover and not request. So NAK'ing requests for this purpose isn't strictly necessary. The resets will be timed so as to not refresh the 60-second cache in case it was hit.
Signed-off-by: Krishna Dhulipala <kdhulipala@nvidia.com>
a73bc75 to
dced39a
Compare
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
When a BMC MAC has suppress_dhcp = true in ignored_bmc_macs, the DiscoverDhcp RPC returns FailedPrecondition and atomically records dhcp_discover_suppressed_at. The decommission workflow polls this timestamp to confirm the BMC DHCP client has returned to INIT state.
No changes to the DHCP server binary; suppression is handled entirely within the existing DiscoverDhcp RPC in NICo Core.
Closes #3816