Print node status even in --quiet mode (#9149)

master
poornas 5 years ago committed by GitHub
parent 496f4a7dc7
commit 59dced8237
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      cmd/server-startup-msg.go

@ -25,6 +25,7 @@ import (
"strings" "strings"
humanize "github.com/dustin/go-humanize" humanize "github.com/dustin/go-humanize"
"github.com/minio/minio/cmd/logger"
color "github.com/minio/minio/pkg/color" color "github.com/minio/minio/pkg/color"
xnet "github.com/minio/minio/pkg/net" xnet "github.com/minio/minio/pkg/net"
) )
@ -249,8 +250,12 @@ func printObjectAPIMsg() {
// Get formatted disk/storage info message. // Get formatted disk/storage info message.
func getStorageInfoMsgSafeMode(storageInfo StorageInfo) string { func getStorageInfoMsgSafeMode(storageInfo StorageInfo) string {
var msg string var msg string
var mcMessage string
if storageInfo.Backend.Type == BackendErasure { if storageInfo.Backend.Type == BackendErasure {
diskInfo := fmt.Sprintf(" %d Online, %d Offline. ", storageInfo.Backend.OnlineDisks.Sum(), storageInfo.Backend.OfflineDisks.Sum()) if storageInfo.Backend.OfflineDisks.Sum() > 0 {
mcMessage = "Run `mc admin info` to look for server/disk info`"
}
diskInfo := fmt.Sprintf(" %d Online, %d Offline.%s ", storageInfo.Backend.OnlineDisks.Sum(), storageInfo.Backend.OfflineDisks.Sum(), mcMessage)
msg += color.Red("Status:") + fmt.Sprintf(getFormatStr(len(diskInfo), 8), diskInfo) msg += color.Red("Status:") + fmt.Sprintf(getFormatStr(len(diskInfo), 8), diskInfo)
} }
return msg return msg
@ -259,8 +264,12 @@ func getStorageInfoMsgSafeMode(storageInfo StorageInfo) string {
// Get formatted disk/storage info message. // Get formatted disk/storage info message.
func getStorageInfoMsg(storageInfo StorageInfo) string { func getStorageInfoMsg(storageInfo StorageInfo) string {
var msg string var msg string
var mcMessage string
if storageInfo.Backend.Type == BackendErasure { if storageInfo.Backend.Type == BackendErasure {
diskInfo := fmt.Sprintf(" %d Online, %d Offline. ", storageInfo.Backend.OnlineDisks.Sum(), storageInfo.Backend.OfflineDisks.Sum()) if storageInfo.Backend.OfflineDisks.Sum() > 0 {
mcMessage = "Use `mc admin info` to look for server/disk info"
}
diskInfo := fmt.Sprintf(" %d Online, %d Offline.%s ", storageInfo.Backend.OnlineDisks.Sum(), storageInfo.Backend.OfflineDisks.Sum(), mcMessage)
msg += color.Blue("Status:") + fmt.Sprintf(getFormatStr(len(diskInfo), 8), diskInfo) msg += color.Blue("Status:") + fmt.Sprintf(getFormatStr(len(diskInfo), 8), diskInfo)
} }
return msg return msg
@ -269,6 +278,9 @@ func getStorageInfoMsg(storageInfo StorageInfo) string {
// Prints startup message of storage capacity and erasure information. // Prints startup message of storage capacity and erasure information.
func printStorageInfo(storageInfo StorageInfo) { func printStorageInfo(storageInfo StorageInfo) {
if msg := getStorageInfoMsg(storageInfo); msg != "" { if msg := getStorageInfoMsg(storageInfo); msg != "" {
if globalCLIContext.Quiet {
logger.Info(msg)
}
logStartupMessage(msg) logStartupMessage(msg)
} }
} }

Loading…
Cancel
Save