failover set offset via rnd and not via reconcile count#664
failover set offset via rnd and not via reconcile count#664
Conversation
📝 WalkthroughWalkthroughThe changes introduce randomized VM selection rotation in the failover controller. When a configurable rotation interval is reached, VM selection switches from deterministic offset calculation to random selection. Configuration logging and test expectations have been updated accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cmd/main.go (1)
625-626: Consider dereferencingVMSelectionRotationIntervalfor clearer logging.
failoverConfig.VMSelectionRotationIntervalis a*int. Logging it directly will print the pointer address (e.g.,0xc0001234) rather than the actual integer value. SinceApplyDefaults()is called at line 563 before this log, the pointer is guaranteed to be non-nil.Suggested fix
setupLog.Info("failover-reservations-controller registered", "datasourceName", failoverConfig.DatasourceName, "schedulerURL", failoverConfig.SchedulerURL, "reconcileInterval", failoverConfig.ReconcileInterval, "revalidationInterval", failoverConfig.RevalidationInterval, "trustHypervisorLocation", failoverConfig.TrustHypervisorLocation, "maxVMsToProcess", failoverConfig.MaxVMsToProcess, - "vmSelectionRotationInterval", failoverConfig.VMSelectionRotationInterval) + "vmSelectionRotationInterval", *failoverConfig.VMSelectionRotationInterval)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cmd/main.go` around lines 625 - 626, The log call is printing the pointer for failoverConfig.VMSelectionRotationInterval (a *int) instead of its integer value; since ApplyDefaults() (called earlier) guarantees it's non-nil, change the logging to dereference the pointer (use *failoverConfig.VMSelectionRotationInterval) so the actual integer is logged; locate the log invocation that includes "vmSelectionRotationInterval" and replace the pointer reference with the dereferenced value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@cmd/main.go`:
- Around line 625-626: The log call is printing the pointer for
failoverConfig.VMSelectionRotationInterval (a *int) instead of its integer
value; since ApplyDefaults() (called earlier) guarantees it's non-nil, change
the logging to dereference the pointer (use
*failoverConfig.VMSelectionRotationInterval) so the actual integer is logged;
locate the log invocation that includes "vmSelectionRotationInterval" and
replace the pointer reference with the dereferenced value.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4aec4706-c9bc-4e99-94e7-65829f738433
📒 Files selected for processing (3)
cmd/main.gointernal/scheduling/reservations/failover/controller.gointernal/scheduling/reservations/failover/controller_test.go
Test Coverage ReportTest Coverage 📊: 68.3% |
No description provided.