Fix storage info message on startup (#9177)

This commit is contained in:
poornas 2020-03-21 10:02:20 -07:00 committed by GitHub
parent bf545dc320
commit 27b8f18cce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,11 +253,14 @@ func getStorageInfoMsgSafeMode(storageInfo StorageInfo) string {
var mcMessage string
if storageInfo.Backend.Type == BackendErasure {
if storageInfo.Backend.OfflineDisks.Sum() > 0 {
mcMessage = "Run `mc admin info` to look for server/disk info`"
mcMessage = "Use `mc admin info` to look for latest server/disk info`"
}
diskInfo := fmt.Sprintf(" %d Online, %d Offline.%s ", storageInfo.Backend.OnlineDisks.Sum(), storageInfo.Backend.OfflineDisks.Sum(), mcMessage)
diskInfo := fmt.Sprintf(" %d Online, %d Offline. ", storageInfo.Backend.OnlineDisks.Sum(), storageInfo.Backend.OfflineDisks.Sum())
msg += color.Red("Status:") + fmt.Sprintf(getFormatStr(len(diskInfo), 8), diskInfo)
}
if len(mcMessage) > 0 {
msg = fmt.Sprintf("%s %s", mcMessage, msg)
}
return msg
}
@ -267,10 +270,14 @@ func getStorageInfoMsg(storageInfo StorageInfo) string {
var mcMessage string
if storageInfo.Backend.Type == BackendErasure {
if storageInfo.Backend.OfflineDisks.Sum() > 0 {
mcMessage = "Use `mc admin info` to look for server/disk info"
mcMessage = "Use `mc admin info` to look for latest server/disk info"
}
diskInfo := fmt.Sprintf(" %d Online, %d Offline.%s ", storageInfo.Backend.OnlineDisks.Sum(), storageInfo.Backend.OfflineDisks.Sum(), mcMessage)
diskInfo := fmt.Sprintf(" %d Online, %d Offline. ", storageInfo.Backend.OnlineDisks.Sum(), storageInfo.Backend.OfflineDisks.Sum())
msg += color.Blue("Status:") + fmt.Sprintf(getFormatStr(len(diskInfo), 8), diskInfo)
if len(mcMessage) > 0 {
msg = fmt.Sprintf("%s %s", mcMessage, msg)
}
}
return msg
}