Improved handling of consumer checks for volume migration#317
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Improves volume migration safety by (1) distinguishing “no consumer” vs “consumer not ready” when deciding whether to run NVMe validation, and (2) making the ContinueMigration step crash-safe by checking the backend migration phase before issuing the continue call (follow-up to #316).
Changes:
- Add uncached Kubernetes reads (APIReader) and richer consumer-state detection to avoid skipping validation for genuinely active volumes and to wait when a consumer pod is Pending.
- Introduce
performMigrationto make ContinueMigration idempotent by checking backendMigrationDTO.Phasebefore continuing. - Expand unit test coverage for skipped validation, waiting behavior, and non-idempotent continue hazards.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/webapi/rebalancing.go | Adds migration phase constant and a helper to classify terminal migration statuses. |
| internal/controller/volumemigration_controller.go | Updates consumer detection (uncached reads + new error cases) and adds crash-safe performMigration logic around ContinueMigration. |
| internal/controller/volumemigration_controller_unit_test.go | Adds tests for consumer-state behavior and for safe ContinueMigration retry semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… after cancellation
2fbd73b to
8e80464
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the consumer is in pending, in-creation state, a volume migration is not allowed to start and has to wait for the pod to be running. If the pod is stopped (replica=0) or the pvc is unbound, we can skip the connect+validation step.
This PR improves the detection and ensures the coming-up pod isn't interrupted or corrupted. This is a follow up of #316.