info: Correctly show pool config with offline node(s) (#4567)
This commit is contained in:
+19
-28
@@ -59,6 +59,7 @@ EXAMPLES:
|
||||
}
|
||||
|
||||
type poolSummary struct {
|
||||
index int
|
||||
setsCount int
|
||||
drivesPerSet int
|
||||
driveTolerance int
|
||||
@@ -75,26 +76,29 @@ func clusterSummaryInfo(info madmin.InfoMessage) clusterInfo {
|
||||
pool := summary[disk.PoolIndex]
|
||||
if pool == nil {
|
||||
pool = &poolSummary{
|
||||
index: disk.PoolIndex,
|
||||
endpoints: set.NewStringSet(),
|
||||
driveTolerance: info.StandardParity(),
|
||||
}
|
||||
}
|
||||
// Deprecated calculation based on disk location
|
||||
if disk.SetIndex+1 > pool.setsCount {
|
||||
pool.setsCount = disk.SetIndex + 1
|
||||
}
|
||||
// Deprecated calculation based on disk location
|
||||
if disk.DiskIndex+1 > pool.drivesPerSet {
|
||||
pool.drivesPerSet = disk.DiskIndex + 1
|
||||
}
|
||||
pool.endpoints.Add(srv.Endpoint)
|
||||
if disk.SetIndex > pool.setsCount {
|
||||
pool.setsCount = disk.SetIndex
|
||||
}
|
||||
if disk.DiskIndex > pool.drivesPerSet {
|
||||
pool.drivesPerSet = disk.DiskIndex
|
||||
}
|
||||
|
||||
summary[disk.PoolIndex] = pool
|
||||
}
|
||||
}
|
||||
// We calculated max set index and max disk index
|
||||
// increase by one to show the number of sets and drives
|
||||
for _, pool := range summary {
|
||||
pool.setsCount++
|
||||
pool.drivesPerSet++
|
||||
|
||||
if len(info.Backend.TotalSets) > 0 { // Check if this is a recent enough MinIO version
|
||||
for _, pool := range summary {
|
||||
pool.setsCount = info.Backend.TotalSets[pool.index]
|
||||
pool.drivesPerSet = info.Backend.DrivesPerSet[pool.index]
|
||||
}
|
||||
}
|
||||
return summary
|
||||
}
|
||||
@@ -144,8 +148,6 @@ func (u clusterStruct) String() (msg string) {
|
||||
|
||||
// Initialization
|
||||
var totalOfflineNodes int
|
||||
var totalOnlineDrivesCluster int
|
||||
var totalOfflineDrivesCluster int
|
||||
|
||||
// Color palette initialization
|
||||
console.SetColor("Info", color.New(color.FgGreen, color.Bold))
|
||||
@@ -189,8 +191,6 @@ func (u clusterStruct) String() (msg string) {
|
||||
}
|
||||
|
||||
totalDrivesPerServer := OnDrives + OffDrives
|
||||
totalOnlineDrivesCluster += OnDrives
|
||||
totalOfflineDrivesCluster += OffDrives
|
||||
|
||||
dispNoOfDrives = strconv.Itoa(OnDrives) + "/" + strconv.Itoa(totalDrivesPerServer)
|
||||
msg += fmt.Sprintf(" Drives: %s %s\n", dispNoOfDrives, console.Colorize("InfoFail", "OK "))
|
||||
@@ -247,8 +247,6 @@ func (u clusterStruct) String() (msg string) {
|
||||
}
|
||||
|
||||
totalDrivesPerServer := OnDrives + OffDrives
|
||||
totalOnlineDrivesCluster += OnDrives
|
||||
totalOfflineDrivesCluster += OffDrives
|
||||
clr := "Info"
|
||||
if OnDrives != totalDrivesPerServer {
|
||||
clr = "InfoWarning"
|
||||
@@ -295,16 +293,9 @@ func (u clusterStruct) String() (msg string) {
|
||||
}
|
||||
// Summary on total no of online and total
|
||||
// number of offline drives at the Cluster level
|
||||
bkInfo, ok := u.Info.Backend.(madmin.ErasureBackend)
|
||||
if ok {
|
||||
msg += fmt.Sprintf("%s online, %s offline\n",
|
||||
english.Plural(bkInfo.OnlineDisks, "drive", ""),
|
||||
english.Plural(bkInfo.OfflineDisks, "drive", ""))
|
||||
} else {
|
||||
msg += fmt.Sprintf("%s online, %s offline\n",
|
||||
english.Plural(totalOnlineDrivesCluster, "drive", ""),
|
||||
english.Plural(totalOfflineDrivesCluster, "drive", ""))
|
||||
}
|
||||
msg += fmt.Sprintf("%s online, %s offline\n",
|
||||
english.Plural(u.Info.Backend.OnlineDisks, "drive", ""),
|
||||
english.Plural(u.Info.Backend.OfflineDisks, "drive", ""))
|
||||
}
|
||||
|
||||
// Remove the last new line if any
|
||||
|
||||
@@ -19,7 +19,7 @@ require (
|
||||
github.com/minio/cli v1.24.2
|
||||
github.com/minio/colorjson v1.0.4
|
||||
github.com/minio/filepath v1.0.0
|
||||
github.com/minio/madmin-go/v2 v2.0.19
|
||||
github.com/minio/madmin-go/v2 v2.1.1
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/minio/minio-go/v7 v7.0.52
|
||||
github.com/minio/pkg v1.6.5
|
||||
|
||||
@@ -518,8 +518,8 @@ github.com/minio/colorjson v1.0.4/go.mod h1:ZgE8vYon4xC4yfBPclP/2gqMRYw+p+xRsBbL
|
||||
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.6.6/go.mod h1:ATvkBOLiP3av4D++2v1UEHC/QzsGtgXD5kYvvRYzdKs=
|
||||
github.com/minio/madmin-go/v2 v2.0.19 h1:XznxdMVCTyr0A88JrZFhdxWY8KLfJcrs0TTmFiE9cc8=
|
||||
github.com/minio/madmin-go/v2 v2.0.19/go.mod h1:8bL1RMNkblIENFSgGYjeHrzUx9PxROb7OqfNuMU9ivE=
|
||||
github.com/minio/madmin-go/v2 v2.1.1 h1:qUdJP31MD3ThPOmvfRby0J5ZJdAw5XK67LxTkUI9DWA=
|
||||
github.com/minio/madmin-go/v2 v2.1.1/go.mod h1:8bL1RMNkblIENFSgGYjeHrzUx9PxROb7OqfNuMU9ivE=
|
||||
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=
|
||||
github.com/minio/minio-go/v7 v7.0.41/go.mod h1:nCrRzjoSUQh8hgKKtu3Y708OLvRLtuASMg2/nvmbarw=
|
||||
|
||||
Reference in New Issue
Block a user