diff --git a/tools-v2/internal/error/error.go b/tools-v2/internal/error/error.go index a4737ba33d..bef898d38c 100644 --- a/tools-v2/internal/error/error.go +++ b/tools-v2/internal/error/error.go @@ -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()) diff --git a/tools-v2/pkg/cli/command/curvefs/update/fs/fs.go b/tools-v2/pkg/cli/command/curvefs/update/fs/fs.go index f4b5ad2c2d..54628fc1d6 100644 --- a/tools-v2/pkg/cli/command/curvefs/update/fs/fs.go +++ b/tools-v2/pkg/cli/command/curvefs/update/fs/fs.go @@ -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, } @@ -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))