diff --git a/cmd/admin-heal.go b/cmd/admin-heal.go index 83ee79be..9d866eab 100644 --- a/cmd/admin-heal.go +++ b/cmd/admin-heal.go @@ -69,6 +69,10 @@ var adminHealFlags = []cli.Flag{ Name: "storage-class", Usage: "show server/disks failure tolerance with the given storage class", }, + cli.BoolFlag{ + Name: "verbose, v", + Usage: "show verbose information", + }, } var adminHealCmd = cli.Command{ @@ -91,11 +95,6 @@ FLAGS: EXAMPLES: 1. Monitor healing status on a running server at alias 'myminio': {{.Prompt}} {{.HelpName}} myminio/ - ... - ... - Summary: - ======= - No ongoing active healing. `, } @@ -131,15 +130,6 @@ func (s stopHealMessage) JSON() string { return string(stopHealJSONBytes) } -// verboseBackgroundHealStatusMessage is container for stop heal success and failure messages. -type verboseBackgroundHealStatusMessage struct { - Status string `json:"status"` - HealInfo madmin.BgHealState - - // Specify storage class to show servers/disks tolerance - ToleranceForSC string `json:"-"` -} - type setIndex struct { pool, set int } @@ -345,6 +335,15 @@ func getOfflineNodes(endpoints []string) map[string]struct{} { return offlineNodes } +// verboseBackgroundHealStatusMessage is container for stop heal success and failure messages. +type verboseBackgroundHealStatusMessage struct { + Status string `json:"status"` + HealInfo madmin.BgHealState + + // Specify storage class to show servers/disks tolerance + ToleranceForSC string `json:"-"` +} + // String colorized to show background heal status message. func (s verboseBackgroundHealStatusMessage) String() string { var msg strings.Builder @@ -628,11 +627,18 @@ func mainAdminHeal(ctx *cli.Context) error { if bucket == "" && !ctx.Bool("recursive") { bgHealStatus, berr := adminClnt.BackgroundHealStatus(globalContext) fatalIf(probe.NewError(berr), "Failed to get the status of the background heal.") - printMsg(verboseBackgroundHealStatusMessage{ - Status: "success", - HealInfo: bgHealStatus, - ToleranceForSC: strings.ToUpper(ctx.String("storage-class")), - }) + if ctx.Bool("verbose") { + printMsg(verboseBackgroundHealStatusMessage{ + Status: "success", + HealInfo: bgHealStatus, + ToleranceForSC: strings.ToUpper(ctx.String("storage-class")), + }) + } else { + printMsg(shortBackgroundHealStatusMessage{ + Status: "success", + HealInfo: bgHealStatus, + }) + } return nil } diff --git a/go.mod b/go.mod index c757bac0..9b7ce036 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/minio/cli v1.22.0 github.com/minio/colorjson v1.0.1 github.com/minio/filepath v1.0.0 - github.com/minio/madmin-go v1.2.4 + github.com/minio/madmin-go v1.2.6 github.com/minio/md5-simd v1.1.2 // indirect github.com/minio/minio-go/v7 v7.0.20 github.com/minio/pkg v1.1.14 diff --git a/go.sum b/go.sum index 2e225b2b..4ffb4075 100644 --- a/go.sum +++ b/go.sum @@ -340,8 +340,8 @@ github.com/minio/colorjson v1.0.1/go.mod h1:oPM3zQQY8Gz9NGtgvuBEjQ+gPZLKAGc7T+kj github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY= github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw= github.com/minio/madmin-go v1.1.23/go.mod h1:wv8zCroSCnpjjQdmgsdJEkFH2oD4w9J40OZqbhxjiJ4= -github.com/minio/madmin-go v1.2.4 h1:o+0X6ENO/AtkRxCbD4FXT6YCRIH7HgDGb+WzfJFDzMQ= -github.com/minio/madmin-go v1.2.4/go.mod h1:/rOfQv4ohkXJ+7EaSnhg9IJEX7cobX08zkSLfh8G3Ks= +github.com/minio/madmin-go v1.2.6 h1:k4q5I+6nV/r7QBFZtvlPWMJh8uOo5AbEMx/39VXP7kg= +github.com/minio/madmin-go v1.2.6/go.mod h1:/rOfQv4ohkXJ+7EaSnhg9IJEX7cobX08zkSLfh8G3Ks= github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=