diff --git a/cmd/admin-heal.go b/cmd/admin-heal.go index 39e32561..ef3c8037 100644 --- a/cmd/admin-heal.go +++ b/cmd/admin-heal.go @@ -67,7 +67,7 @@ var adminHealFlags = []cli.Flag{ }, cli.StringFlag{ Name: "storage-class", - Usage: "show server/disks failure tolerance with the given storage class", + Usage: "show server/drives failure tolerance with the given storage class", }, cli.BoolFlag{ Name: "rewrite", @@ -81,7 +81,7 @@ var adminHealFlags = []cli.Flag{ var adminHealCmd = cli.Command{ Name: "heal", - Usage: "heal disks, buckets and objects on MinIO server", + Usage: "heal bucket(s) and object(s) on MinIO server", Action: mainAdminHeal, OnUsageError: onUsageError, Before: setGlobalsFromContext, @@ -177,7 +177,7 @@ func (s serverInfo) onlineDisksForSet(index setIndex) (setFound bool, count int) return } -// Get all disks from set statuses +// Get all drives from set statuses func getAllDisks(sets []madmin.SetStatus) []madmin.Disk { var disks []madmin.Disk for _, set := range sets { @@ -186,7 +186,7 @@ func getAllDisks(sets []madmin.SetStatus) []madmin.Disk { return disks } -// Get all pools id from all disks +// Get all pools id from all drives func getPoolsIndexes(disks []madmin.Disk) []int { m := make(map[int]struct{}) for _, d := range disks { @@ -413,7 +413,7 @@ func (s verboseBackgroundHealStatusMessage) String() string { } fmt.Fprintf(&msg, " |__ Capacity: %s/%s\n", humanize.IBytes(d.usedSpace), humanize.IBytes(d.totalSpace)) if showTolerance { - fmt.Fprintf(&msg, " |__ Tolerance: %d disk(s)\n", parity-setsStatus[d.set].incapableDisks) + fmt.Fprintf(&msg, " |__ Tolerance: %d drive(s)\n", parity-setsStatus[d.set].incapableDisks) } } @@ -475,7 +475,7 @@ func (s shortBackgroundHealStatusMessage) String() string { // this is needed to calculate the rate of healing accumulatedElapsedTime time.Duration - // ETA of healing - it is the latest ETA of all disks currently healing + // ETA of healing - it is the latest ETA of all drives currently healing healingRemaining time.Duration ) diff --git a/cmd/admin-info.go b/cmd/admin-info.go index da09885f..d7a873b0 100644 --- a/cmd/admin-info.go +++ b/cmd/admin-info.go @@ -269,7 +269,7 @@ func (u clusterStruct) String() (msg string) { if backendType == madmin.Erasure { msg += fmt.Sprintf("Pools:\n") for pool, summary := range clusterSummary { - msg += fmt.Sprintf(" %s, Erasure sets: %d, Disks per erasure set: %d\n", + msg += fmt.Sprintf(" %s, Erasure sets: %d, Drives per erasure set: %d\n", console.Colorize("Info", humanize.Ordinal(pool+1)), summary.setsCount, summary.drivesPerSet) } } diff --git a/cmd/admin-scanner-status.go b/cmd/admin-scanner-status.go index e2f03e55..a99a2ba9 100644 --- a/cmd/admin-scanner-status.go +++ b/cmd/admin-scanner-status.go @@ -262,10 +262,10 @@ func (m *scannerMetricsUI) View() string { } if sc.CurrentCycle > 0 { addRowF(title("Current cycle:")+" %s; Started: %v", ui(sc.CurrentCycle), console.Colorize("metrics-date", sc.CurrentStarted)) - addRowF(title("Active disks:")+" %s", ui(uint64(len(sc.ActivePaths)))) + addRowF(title("Active drives:")+" %s", ui(uint64(len(sc.ActivePaths)))) } else { addRowF(title("Current cycle:") + " (between cycles)") - addRowF(title("Active disks:")+" %s", ui(uint64(len(sc.ActivePaths)))) + addRowF(title("Active drives:")+" %s", ui(uint64(len(sc.ActivePaths)))) } addRow("-------------------------------------- Last Minute Statistics ---------------------------------------") objs := uint64(0) diff --git a/cmd/auto-complete.go b/cmd/auto-complete.go index 3ba6ed4d..60b2bacb 100644 --- a/cmd/auto-complete.go +++ b/cmd/auto-complete.go @@ -436,6 +436,7 @@ var completeCmds = map[string]complete.Predictor{ "/support/status": aliasCompleter, "/support/top/locks": aliasCompleter, "/support/top/api": aliasCompleter, + "/support/top/drive": aliasCompleter, "/support/top/disk": aliasCompleter, "/license/register": aliasCompleter, diff --git a/cmd/support-top-disk.go b/cmd/support-top-drive.go similarity index 74% rename from cmd/support-top-disk.go rename to cmd/support-top-drive.go index f281a5df..963c428f 100644 --- a/cmd/support-top-disk.go +++ b/cmd/support-top-drive.go @@ -19,7 +19,6 @@ package cmd import ( "context" - "log" "time" tea "github.com/charmbracelet/bubbletea" @@ -28,21 +27,22 @@ import ( "github.com/minio/mc/pkg/probe" ) -var supportTopDiskFlags = []cli.Flag{ +var supportTopDriveFlags = []cli.Flag{ cli.IntFlag{ Name: "count, c", - Usage: "show up to N disks", + Usage: "show up to N drives", Value: 10, }, } -var supportTopDiskCmd = cli.Command{ - Name: "disk", - Usage: "show current disk statistics", - Action: mainSupportTopDisk, +var supportTopDriveCmd = cli.Command{ + Name: "drive", + Aliases: []string{"disk"}, + Usage: "show real-time drive metrics", + Action: mainSupportTopDrive, OnUsageError: onUsageError, Before: setGlobalsFromContext, - Flags: append(supportTopDiskFlags, globalFlags...), + Flags: append(supportTopDriveFlags, globalFlags...), HideHelpCommand: true, CustomHelpTemplate: `NAME: {{.HelpName}} - {{.Usage}} @@ -54,21 +54,20 @@ FLAGS: {{range .VisibleFlags}}{{.}} {{end}} EXAMPLES: - 1. Display disks metrics + 1. Display drive metrics {{.Prompt}} {{.HelpName}} myminio/ - `, } -// checkSupportTopDiskSyntax - validate all the passed arguments -func checkSupportTopDiskSyntax(ctx *cli.Context) { +// checkSupportTopDriveSyntax - validate all the passed arguments +func checkSupportTopDriveSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - cli.ShowCommandHelpAndExit(ctx, "disk", 1) // last argument is exit code + cli.ShowCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code } } -func mainSupportTopDisk(ctx *cli.Context) error { - checkSupportTopDiskSyntax(ctx) +func mainSupportTopDrive(ctx *cli.Context) error { + checkSupportTopDriveSyntax(ctx) aliasedURL := ctx.Args().Get(0) @@ -97,11 +96,11 @@ func mainSupportTopDisk(ctx *cli.Context) error { ByDisk: true, } - p := tea.NewProgram(initTopDiskUI(disks, ctx.Int("count"))) + p := tea.NewProgram(initTopDriveUI(disks, ctx.Int("count"))) go func() { out := func(m madmin.RealtimeMetrics) { for name, metric := range m.ByDisk { - p.Send(topDiskResult{ + p.Send(topDriveResult{ diskName: name, stats: metric.IOStats, }) @@ -110,13 +109,13 @@ func mainSupportTopDisk(ctx *cli.Context) error { e := client.Metrics(ctxt, opts, out) if e != nil { - log.Fatalln(probe.NewError(e), "Unable to fetch top disks") + fatalIf(probe.NewError(e), "Unable to fetch top drives events") } }() if e := p.Start(); e != nil { cancel() - fatalIf(probe.NewError(e).Trace(aliasedURL), "Unable to fetch top disks events") + fatalIf(probe.NewError(e).Trace(aliasedURL), "Unable to fetch top drive events") } return nil diff --git a/cmd/support-top.go b/cmd/support-top.go index c8fa7afd..863a1693 100644 --- a/cmd/support-top.go +++ b/cmd/support-top.go @@ -21,8 +21,8 @@ import "github.com/minio/cli" var supportTopSubcommands = []cli.Command{ supportTopAPICmd, + supportTopDriveCmd, supportTopLocksCmd, - supportTopDiskCmd, } var supportTopCmd = cli.Command{ diff --git a/cmd/top-disk-spinner.go b/cmd/top-drives-spinner.go similarity index 87% rename from cmd/top-disk-spinner.go rename to cmd/top-drives-spinner.go index ba0157d1..868170fd 100644 --- a/cmd/top-disk-spinner.go +++ b/cmd/top-drives-spinner.go @@ -29,7 +29,7 @@ import ( "github.com/olekukonko/tablewriter" ) -type topDiskUI struct { +type topDriveUI struct { spinner spinner.Model quitting bool @@ -37,23 +37,23 @@ type topDiskUI struct { count int pool, maxPool int - disksInfo map[string]madmin.Disk + drivesInfo map[string]madmin.Disk prevTopMap map[string]madmin.DiskIOStats currTopMap map[string]madmin.DiskIOStats } -type topDiskResult struct { +type topDriveResult struct { final bool diskName string stats madmin.DiskIOStats } -func initTopDiskUI(disks []madmin.Disk, count int) *topDiskUI { +func initTopDriveUI(disks []madmin.Disk, count int) *topDriveUI { maxPool := 0 - disksInfo := make(map[string]madmin.Disk) + drivesInfo := make(map[string]madmin.Disk) for i := range disks { - disksInfo[disks[i].Endpoint] = disks[i] + drivesInfo[disks[i].Endpoint] = disks[i] if disks[i].PoolIndex > maxPool { maxPool = disks[i].PoolIndex } @@ -62,23 +62,23 @@ func initTopDiskUI(disks []madmin.Disk, count int) *topDiskUI { s := spinner.New() s.Spinner = spinner.Points s.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("205")) - return &topDiskUI{ + return &topDriveUI{ count: count, sortBy: sortByName, pool: 0, maxPool: maxPool, - disksInfo: disksInfo, + drivesInfo: drivesInfo, spinner: s, prevTopMap: make(map[string]madmin.DiskIOStats), currTopMap: make(map[string]madmin.DiskIOStats), } } -func (m *topDiskUI) Init() tea.Cmd { +func (m *topDriveUI) Init() tea.Cmd { return m.spinner.Tick } -func (m *topDiskUI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { +func (m *topDriveUI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { case tea.KeyMsg: switch msg.String() { @@ -110,7 +110,7 @@ func (m *topDiskUI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } return m, nil - case topDiskResult: + case topDriveResult: m.prevTopMap[msg.diskName] = m.currTopMap[msg.diskName] m.currTopMap[msg.diskName] = msg.stats if msg.final { @@ -128,7 +128,7 @@ func (m *topDiskUI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } } -type diskIOStat struct { +type driveIOStat struct { endpoint string util float64 await float64 @@ -139,7 +139,7 @@ type diskIOStat struct { used uint64 } -func generateDiskStat(disk madmin.Disk, curr, prev madmin.DiskIOStats, interval uint64) (d diskIOStat) { +func generateDriveStat(disk madmin.Disk, curr, prev madmin.DiskIOStats, interval uint64) (d driveIOStat) { d.endpoint = disk.Endpoint d.used = 100 * disk.UsedSpace / disk.TotalSpace d.util = 100 * float64(curr.TotalTicks-prev.TotalTicks) / float64(interval) @@ -192,7 +192,7 @@ func (s sortIOStat) String() string { return "unknown" } -func (m *topDiskUI) View() string { +func (m *topDriveUI) View() string { var s strings.Builder s.WriteString("\n") @@ -210,16 +210,16 @@ func (m *topDiskUI) View() string { table.SetTablePadding("\t") // pad with tabs table.SetNoWhiteSpace(true) - table.SetHeader([]string{"Disk", "used", "tps", "read", "write", "discard", "await", "util"}) + table.SetHeader([]string{"Drive", "used", "tps", "read", "write", "discard", "await", "util"}) - var data []diskIOStat + var data []driveIOStat for disk := range m.currTopMap { - currDisk, ok := m.disksInfo[disk] + currDisk, ok := m.drivesInfo[disk] if !ok || currDisk.PoolIndex != m.pool { continue } - data = append(data, generateDiskStat(m.disksInfo[disk], m.currTopMap[disk], m.prevTopMap[disk], 1000)) + data = append(data, generateDriveStat(m.drivesInfo[disk], m.currTopMap[disk], m.prevTopMap[disk], 1000)) } sort.Slice(data, func(i, j int) bool { @@ -251,7 +251,7 @@ func (m *topDiskUI) View() string { dataRender := make([][]string, 0, len(data)) for _, d := range data { endpoint := d.endpoint - diskInfo := m.disksInfo[endpoint] + diskInfo := m.drivesInfo[endpoint] if diskInfo.Healing { endpoint += "!" } diff --git a/docs/minio-admin-complete-guide.md b/docs/minio-admin-complete-guide.md index f1365a47..1b4a5a59 100644 --- a/docs/minio-admin-complete-guide.md +++ b/docs/minio-admin-complete-guide.md @@ -12,7 +12,7 @@ policy manage policies defined in the MinIO server replicate manage MinIO site replication config manage MinIO server configuration decommission, decom manage MinIO server pool decommissioning -heal heal disks, buckets and objects on MinIO server +heal heal bucket(s) and object(s) on MinIO server prometheus manages prometheus config kms perform KMS management operations bucket manage buckets defined in the MinIO server @@ -300,7 +300,7 @@ Skip SSL certificate verification. | [**group** - manage groups](#group) | | [**policy** - manage canned policies](#policy) | | [**config** - manage server configuration file](#config) | -| [**heal** - heal disks, buckets and objects on MinIO server](#heal) | +| [**heal** - heal bucket(s) and object(s) on MinIO server](#heal) | | [**top** - provide top like statistics for MinIO](#top) | | [**trace** - show http trace for MinIO server](#trace) | | [**console** - show console logs for MinIO server](#console) | @@ -642,10 +642,8 @@ mc admin config import myminio < /tmp/my-serverconfig ``` -### Command `heal` - Heal disks, buckets and objects on MinIO server -Healing is automatic on server side which runs on a continuous basis on a low priority thread, `mc admin heal` is deprecated and will be removed in future. - - +### Command `heal` - heal bucket(s) and object(s) on MinIO server +Healing is automatic on server side which runs on a continuous basis on a low priority thread. ### Command `trace` - Show http trace for MinIO server