[#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,
|
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) {
|
func startEvacuateShard(cmd *cobra.Command, _ []string) {
|
||||||
pk := key.Get(cmd)
|
pk := key.Get(cmd)
|
||||||
|
|
||||||
|
@ -152,6 +159,29 @@ func stopEvacuateShardStatus(cmd *cobra.Command, _ []string) {
|
||||||
cmd.Println("Evacuation stopped.")
|
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) {
|
func waitEvacuateCompletion(cmd *cobra.Command, pk *ecdsa.PrivateKey, cli *clientSDK.Client, printProgress, printCompleted bool) {
|
||||||
const statusPollingInterval = 1 * time.Second
|
const statusPollingInterval = 1 * time.Second
|
||||||
const reportIntervalSeconds = 5
|
const reportIntervalSeconds = 5
|
||||||
|
@ -323,10 +353,12 @@ func initControlEvacuationShardCmd() {
|
||||||
evacuationShardCmd.AddCommand(startEvacuationShardCmd)
|
evacuationShardCmd.AddCommand(startEvacuationShardCmd)
|
||||||
evacuationShardCmd.AddCommand(getEvacuationShardStatusCmd)
|
evacuationShardCmd.AddCommand(getEvacuationShardStatusCmd)
|
||||||
evacuationShardCmd.AddCommand(stopEvacuationShardCmd)
|
evacuationShardCmd.AddCommand(stopEvacuationShardCmd)
|
||||||
|
evacuationShardCmd.AddCommand(resetEvacuationStatusShardCmd)
|
||||||
|
|
||||||
initControlStartEvacuationShardCmd()
|
initControlStartEvacuationShardCmd()
|
||||||
initControlFlags(getEvacuationShardStatusCmd)
|
initControlFlags(getEvacuationShardStatusCmd)
|
||||||
initControlFlags(stopEvacuationShardCmd)
|
initControlFlags(stopEvacuationShardCmd)
|
||||||
|
initControlFlags(resetEvacuationStatusShardCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func initControlStartEvacuationShardCmd() {
|
func initControlStartEvacuationShardCmd() {
|
||||||
|
|
|
@ -20,6 +20,8 @@ Only one running evacuation process is allowed on the node at a time.
|
||||||
|
|
||||||
`frostfs-cli control shards evacuation status` prints evacuation process status.
|
`frostfs-cli control shards evacuation status` prints evacuation process status.
|
||||||
|
|
||||||
|
`frostfs-cli control shards evacuation reset` resets evacuation process status.
|
||||||
|
|
||||||
See commands `--help` output for detailed description.
|
See commands `--help` output for detailed description.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
|
@ -8,25 +8,26 @@ import (
|
||||||
const serviceName = "control.ControlService"
|
const serviceName = "control.ControlService"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
rpcHealthCheck = "HealthCheck"
|
rpcHealthCheck = "HealthCheck"
|
||||||
rpcSetNetmapStatus = "SetNetmapStatus"
|
rpcSetNetmapStatus = "SetNetmapStatus"
|
||||||
rpcDropObjects = "DropObjects"
|
rpcDropObjects = "DropObjects"
|
||||||
rpcListShards = "ListShards"
|
rpcListShards = "ListShards"
|
||||||
rpcSetShardMode = "SetShardMode"
|
rpcSetShardMode = "SetShardMode"
|
||||||
rpcSynchronizeTree = "SynchronizeTree"
|
rpcSynchronizeTree = "SynchronizeTree"
|
||||||
rpcEvacuateShard = "EvacuateShard"
|
rpcEvacuateShard = "EvacuateShard"
|
||||||
rpcStartShardEvacuation = "StartShardEvacuation"
|
rpcStartShardEvacuation = "StartShardEvacuation"
|
||||||
rpcGetShardEvacuationStatus = "GetShardEvacuationStatus"
|
rpcGetShardEvacuationStatus = "GetShardEvacuationStatus"
|
||||||
rpcStopShardEvacuation = "StopShardEvacuation"
|
rpcResetShardEvacuationStatus = "ResetShardEvacuationStatus"
|
||||||
rpcFlushCache = "FlushCache"
|
rpcStopShardEvacuation = "StopShardEvacuation"
|
||||||
rpcDoctor = "Doctor"
|
rpcFlushCache = "FlushCache"
|
||||||
rpcAddChainLocalOverride = "AddChainLocalOverride"
|
rpcDoctor = "Doctor"
|
||||||
rpcGetChainLocalOverride = "GetChainLocalOverride"
|
rpcAddChainLocalOverride = "AddChainLocalOverride"
|
||||||
rpcListChainLocalOverrides = "ListChainLocalOverrides"
|
rpcGetChainLocalOverride = "GetChainLocalOverride"
|
||||||
rpcRemoveChainLocalOverride = "RemoveChainLocalOverride"
|
rpcListChainLocalOverrides = "ListChainLocalOverrides"
|
||||||
rpcSealWriteCache = "SealWriteCache"
|
rpcRemoveChainLocalOverride = "RemoveChainLocalOverride"
|
||||||
rpcListTargetsLocalOverrides = "ListTargetsLocalOverrides"
|
rpcSealWriteCache = "SealWriteCache"
|
||||||
rpcDetachShards = "DetachShards"
|
rpcListTargetsLocalOverrides = "ListTargetsLocalOverrides"
|
||||||
|
rpcDetachShards = "DetachShards"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HealthCheck executes ControlService.HealthCheck RPC.
|
// HealthCheck executes ControlService.HealthCheck RPC.
|
||||||
|
@ -190,6 +191,19 @@ func StopShardEvacuation(cli *client.Client, req *StopShardEvacuationRequest, op
|
||||||
return wResp.message, nil
|
return wResp.message, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResetShardEvacuationStatus executes ControlService.ResetShardEvacuationStatus RPC.
|
||||||
|
func ResetShardEvacuationStatus(cli *client.Client, req *ResetShardEvacuationStatusRequest, opts ...client.CallOption) (*ResetShardEvacuationStatusResponse, error) {
|
||||||
|
wResp := newResponseWrapper[ResetShardEvacuationStatusResponse]()
|
||||||
|
wReq := &requestWrapper{m: req}
|
||||||
|
|
||||||
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcResetShardEvacuationStatus), wReq, wResp, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return wResp.message, nil
|
||||||
|
}
|
||||||
|
|
||||||
// FlushCache executes ControlService.FlushCache RPC.
|
// FlushCache executes ControlService.FlushCache RPC.
|
||||||
func FlushCache(cli *client.Client, req *FlushCacheRequest, opts ...client.CallOption) (*FlushCacheResponse, error) {
|
func FlushCache(cli *client.Client, req *FlushCacheRequest, opts ...client.CallOption) (*FlushCacheResponse, error) {
|
||||||
wResp := newResponseWrapper[FlushCacheResponse]()
|
wResp := newResponseWrapper[FlushCacheResponse]()
|
||||||
|
|
Loading…
Reference in a new issue