forked from TrueCloudLab/frostfs-node
[#1043] cli: Add reset evacuation status command
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
31e2396a5f
commit
17f5463389
3 changed files with 67 additions and 19 deletions
|
@ -53,6 +53,13 @@ var stopEvacuationShardCmd = &cobra.Command{
|
|||
Run: stopEvacuateShardStatus,
|
||||
}
|
||||
|
||||
var resetEvacuationStatusShardCmd = &cobra.Command{
|
||||
Use: "reset",
|
||||
Short: "Reset evacuate objects from shard status",
|
||||
Long: "Reset evacuate objects from shard to other shards status",
|
||||
Run: resetEvacuateShardStatus,
|
||||
}
|
||||
|
||||
func startEvacuateShard(cmd *cobra.Command, _ []string) {
|
||||
pk := key.Get(cmd)
|
||||
|
||||
|
@ -152,6 +159,29 @@ func stopEvacuateShardStatus(cmd *cobra.Command, _ []string) {
|
|||
cmd.Println("Evacuation stopped.")
|
||||
}
|
||||
|
||||
func resetEvacuateShardStatus(cmd *cobra.Command, _ []string) {
|
||||
pk := key.Get(cmd)
|
||||
req := &control.ResetShardEvacuationStatusRequest{
|
||||
Body: &control.ResetShardEvacuationStatusRequest_Body{},
|
||||
}
|
||||
|
||||
signRequest(cmd, pk, req)
|
||||
|
||||
cli := getClient(cmd, pk)
|
||||
|
||||
var resp *control.ResetShardEvacuationStatusResponse
|
||||
var err error
|
||||
err = cli.ExecRaw(func(client *client.Client) error {
|
||||
resp, err = control.ResetShardEvacuationStatus(client, req)
|
||||
return err
|
||||
})
|
||||
commonCmd.ExitOnErr(cmd, "Reset shards evacuation status failed, rpc error: %w", err)
|
||||
|
||||
verifyResponse(cmd, resp.GetSignature(), resp.GetBody())
|
||||
|
||||
cmd.Println("Shards evacuation status has been reset.")
|
||||
}
|
||||
|
||||
func waitEvacuateCompletion(cmd *cobra.Command, pk *ecdsa.PrivateKey, cli *clientSDK.Client, printProgress, printCompleted bool) {
|
||||
const statusPollingInterval = 1 * time.Second
|
||||
const reportIntervalSeconds = 5
|
||||
|
@ -323,10 +353,12 @@ func initControlEvacuationShardCmd() {
|
|||
evacuationShardCmd.AddCommand(startEvacuationShardCmd)
|
||||
evacuationShardCmd.AddCommand(getEvacuationShardStatusCmd)
|
||||
evacuationShardCmd.AddCommand(stopEvacuationShardCmd)
|
||||
evacuationShardCmd.AddCommand(resetEvacuationStatusShardCmd)
|
||||
|
||||
initControlStartEvacuationShardCmd()
|
||||
initControlFlags(getEvacuationShardStatusCmd)
|
||||
initControlFlags(stopEvacuationShardCmd)
|
||||
initControlFlags(resetEvacuationStatusShardCmd)
|
||||
}
|
||||
|
||||
func initControlStartEvacuationShardCmd() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue