feat(api): add rebalance option for clone and snapshot restore#488
Draft
kvaps wants to merge 3 commits intoLINBIT:masterfrom
Draft
feat(api): add rebalance option for clone and snapshot restore#488kvaps wants to merge 3 commits intoLINBIT:masterfrom
kvaps wants to merge 3 commits intoLINBIT:masterfrom
Conversation
Add a `rebalance` boolean field to both ResourceDefinitionCloneRequest and SnapshotRestore OpenAPI schemas. When set, replicas will be migrated to autoplacer-optimal nodes after the operation completes. Regenerate JsonGenTypes.java from the updated OpenAPI spec. Ref: LINBIT#487 Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Pass the new rebalance parameter from REST endpoints through to the handler methods for both clone (CtrlRscDfnApiCallHandler) and snapshot restore (CtrlSnapshotRestoreApiCallHandler). When rebalance is true, CtrlRscRebalanceHelper.trigger() is called after the operation completes. Existing callers (rollback, backup restore) pass null for rebalance. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
…igration Implement a helper that migrates replicas to autoplacer-optimal nodes after clone or snapshot restore. The helper queries the autoplacer for fresh optimal placement, computes migration pairs, and sequentially triggers migrate-disk (toggle-disk with MigrateFrom) for each pair. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
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.
Summary
Add a
rebalanceboolean parameter to the clone (POST /v1/resource-definitions/{rscName}/clone) and snapshot restore (POST /v1/resource-definitions/{rscName}/snapshot-restore-resource/{snapName}) REST APIs.When set to
true, after clone/restore completes, replicas are migrated to autoplacer-optimal nodes via sequential migrate-disk (toggle-disk with MigrateFrom) calls. This prevents replica concentration on source nodes in golden-image use cases (many VMs cloned from one template).How it works
resourceToggleDiskcalls withmigrateFromtrigger async data sync and source cleanupWithout the flag, behavior is unchanged.
Ref: #487
Changes
rebalancefield toResourceDefinitionCloneRequestandSnapshotRestoreCtrlRscRebalanceHelper: computes optimal placement and triggers migrate-diskTest plan
./gradlew compileJavapasses (verified locally)Note
CLI support (
--rebalanceflag) requires a corresponding change in linstor-client.