Skip to content

Commit

Permalink
tools-v2: fix update fs bug
Browse files Browse the repository at this point in the history
Signed-off-by: h0hmj <[email protected]>
  • Loading branch information
h0hmj committed Nov 20, 2023
1 parent d890424 commit eb468ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions tools-v2/internal/error/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,19 @@ var (
}
return NewRpcReultCmdError(statusCode, message)
}
ErrUpdateFs = func(statusCode int) *CmdError {
var message string
code := mds.FSStatusCode(statusCode)
switch code {
case mds.FSStatusCode_OK:
message = "success"
case mds.FSStatusCode_NOT_FOUND:
message = "fs not found!"
default:
message = fmt.Sprintf("update fs failed!, error is %s", mds.FSStatusCode_name[int32(code)])
}
return NewRpcReultCmdError(statusCode, message)
}
ErrGetCopysetsInfo = func(statusCode int) *CmdError {
code := topology.TopoStatusCode(statusCode)
message := fmt.Sprintf("get copysets info failed: status code is %s", code.String())
Expand Down
6 changes: 3 additions & 3 deletions tools-v2/pkg/cli/command/curvefs/update/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (fCmd *FsCommand) AddFlags() {

func (fCmd *FsCommand) Init(cmd *cobra.Command, args []string) error {
// args check
fsName, _ := cmd.Flags().GetString("fsName")
fsName, _ := cmd.Flags().GetString(config.CURVEFS_FSNAME)
request := &mds.UpdateFsInfoRequest{
FsName: &fsName,
}
Expand Down Expand Up @@ -131,10 +131,10 @@ func (fCmd *FsCommand) RunCommand(cmd *cobra.Command, args []string) error {
}

response := result.(*mds.UpdateFsInfoResponse)
errCreate := cmderror.ErrCreateFs(int(response.GetStatusCode()))
errUpdateFs := cmderror.ErrUpdateFs(int(response.GetStatusCode()))
row := map[string]string{
cobrautil.ROW_FS_NAME: fCmd.Rpc.Request.GetFsName(),
cobrautil.ROW_RESULT: errCreate.Message,
cobrautil.ROW_RESULT: errUpdateFs.Message,
}

fCmd.TableNew.Append(cobrautil.Map2List(row, fCmd.Header))
Expand Down

0 comments on commit eb468ed

Please sign in to comment.