feat(admin): add expansion workflow command#180
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78e79a2b98
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// Manage post-expansion data rebalancing | ||
| #[command(alias = "scale", subcommand)] | ||
| Expand(expand::ExpandCommands), |
There was a problem hiding this comment.
Document the new CLI contract in SPEC
Adding the public rc admin expand command changes the CLI contract, but docs/SPEC.md still only documents admin rebalance and has no admin expand syntax, alias, JSON-output references, or exit-code section. Since AGENTS.md identifies docs/SPEC.md as the CLI behavior contract and the PR checklist requires contract changes to be documented, users and any spec-based validation will miss this new workflow even though it is now exposed in help and README.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Adds an expansion-oriented admin command group to guide operators through the post-pool-expansion rebalance workflow, reusing the existing rebalance Admin API integration.
Changes:
- Introduces
rc admin expand start|status|stop(withscalealias) as a wrapper around existing rebalance functionality. - Refactors rebalance command internals to share start/stop behavior with customizable messages.
- Updates README examples and help contract tests; extends the v2 output schema with expand-related entries.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
schemas/output_v2.json |
Adds schema entries for admin expand outputs (status + operation). |
README.md |
Documents rc admin expand usage and adds it to the admin subcommand table. |
crates/cli/tests/help_contract.rs |
Adds help contract coverage for rc admin expand and its subcommands. |
crates/cli/src/commands/admin/rebalance.rs |
Extracts reusable start/stop helpers and exposes status executor for reuse. |
crates/cli/src/commands/admin/mod.rs |
Wires the new expand command (and scale alias) into the admin command tree. |
crates/cli/src/commands/admin/expand.rs |
Implements the new expansion workflow command group by delegating to rebalance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| message: "Rebalance started successfully".to_string(), | ||
| message: success_message.to_string(), | ||
| target: args.alias, | ||
| id: Some(result.id), |
| "title": "admin expand status", | ||
| "description": "Post-expansion rebalance status output", | ||
| "$ref": "#/definitions/rebalanceStatus" | ||
| }, | ||
| { |
| "title": "admin expand operation", | ||
| "description": "Post-expansion rebalance start/stop output", | ||
| "type": "object", | ||
| "required": [ | ||
| "success", | ||
| "message", | ||
| "target" | ||
| ], | ||
| "properties": { | ||
| "success": { | ||
| "type": "boolean" | ||
| }, | ||
| "message": { | ||
| "type": "string" | ||
| }, | ||
| "target": { | ||
| "type": "string" | ||
| }, | ||
| "id": { | ||
| "type": "string", | ||
| "description": "Rebalance operation ID returned by start" | ||
| } | ||
| } | ||
| }, | ||
| { |
Related Issue(s)
None.
Problem Background and User Impact
RustFS expansion requires operators to add server pools in the deployment configuration first, then run a post-expansion rebalance. The CLI exposed pool inspection and rebalance commands separately, but did not provide an expansion-oriented command path.
Root Cause Summary
The existing admin command set had the backend rebalance API integration, but no dedicated command that matches the expansion workflow language users expect.
Solution Overview
rc admin expand start|status|stopfor post-expansion rebalancing.scaleas a convenience alias for the same command group.Test Status
cargo fmt --all --checkcargo clippy --workspace -- -D warningscargo test --workspace