fix: validate expected interface roles and fixed addresses - #4255
Conversation
|
@coderabbitai full_review, thanks! |
|
🐇🔍 ✅ Action performedFull review finished. |
WalkthroughExpected-interface allocation now distinguishes legacy Host behavior from managed-prefix-required fixed allocation. Segment resolution, preallocation reconciliation, duplicate-MAC role validation, API updates, tests, and related CLI/protobuf documentation are updated accordingly. ChangesExpected interface allocation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ExpectedMachineUpdate
participant validate_expected_interface_role_and_allocation
participant update_preallocated_expected_machine_interface
participant preallocate_expected_machine_interface
participant for_managed_static_address
ExpectedMachineUpdate->>validate_expected_interface_role_and_allocation: validate host NIC roles and allocations
ExpectedMachineUpdate->>update_preallocated_expected_machine_interface: apply expected interface settings
update_preallocated_expected_machine_interface->>preallocate_expected_machine_interface: pass require_managed_prefix
preallocate_expected_machine_interface->>for_managed_static_address: resolve fixed IP segment
for_managed_static_address-->>preallocate_expected_machine_interface: return managed segment or InvalidArgument
preallocate_expected_machine_interface-->>ExpectedMachineUpdate: materialize or reject interface update
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Reject duplicate expected interface entries when one MAC names different roles, since DHCP and Site Explorer would otherwise interpret the same interface differently. Explicit fixed allocation policies and DPU roles now require fixed_ip to fall within a configured managed prefix. Existing exact reservations must also belong to that segment, while legacy Host entries that omit the new policy fields keep the static-assignments fallback. This supports NVIDIA#3990 Signed-off-by: Chet Nichols III <chetn@nvidia.com>
ca0f83d to
b34f01d
Compare
🔐 TruffleHog Secret Scan✅ No secrets or credentials found! Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉 🕐 Last updated: 2026-07-28 19:02:30 UTC | Commit: b34f01d |
Reject duplicate expected interface entries when one MAC names different roles, since DHCP and Site Explorer would otherwise interpret the same interface differently.
Explicit fixed allocation policies and DPU roles now require
fixed_ipto fall within a configured managed prefix. Existing exact reservations must also belong to that segment, while legacy Host entries that omit the new policy fields keep thestatic-assignmentsfallback.Related issues
This supports #3990
Follow-up to #3991.
Type of Change
Breaking Changes
Testing
Validated with focused model, Core, database, and generated Go protobuf tests, plus
cargo make format-nightly,cargo make check-format-nightly,cargo make clippy, andcargo make carbide-lints.The uncommitted diff was also reviewed with CodeRabbit CLI and the local Claude review helper. Their actionable findings are included in this commit.
Additional Notes
This PR has no database migration or protobuf schema change. The generated Go protobuf diff contains comment updates only.
ExpectedMachine declarations may still be stored before their network segments exist. Strict managed-prefix validation happens when the reservation is materialized or updated.