From 0611233f16ff0e8f4b99aa6528f47153efd9a846 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 16 Feb 2021 10:55:30 -0800 Subject: [PATCH] adjust printing --- weed/shell/command_volume_list.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.go index 140998338..dc8783cd1 100644 --- a/weed/shell/command_volume_list.go +++ b/weed/shell/command_volume_list.go @@ -48,6 +48,9 @@ func (c *commandVolumeList) Do(args []string, commandEnv *CommandEnv, writer io. func diskInfosToString(diskInfos map[string]*master_pb.DiskInfo) string { var buf bytes.Buffer for diskType, diskInfo := range diskInfos { + if diskType == "" { + diskType = "hdd" + } fmt.Fprintf(&buf, " %s(volume:%d/%d active:%d free:%d remote:%d)", diskType, diskInfo.VolumeCount, diskInfo.MaxVolumeCount, diskInfo.ActiveVolumeCount, diskInfo.FreeVolumeCount, diskInfo.RemoteVolumeCount) } return buf.String() @@ -107,7 +110,11 @@ func writeDataNodeInfo(writer io.Writer, t *master_pb.DataNodeInfo) statistics { func writeDiskInfo(writer io.Writer, t *master_pb.DiskInfo) statistics { var s statistics - fmt.Fprintf(writer, " Disk %s(%s)\n", t.Type, diskInfoToString(t)) + diskType := t.Type + if diskType == "" { + diskType = "hdd" + } + fmt.Fprintf(writer, " Disk %s(%s)\n", diskType, diskInfoToString(t)) sort.Slice(t.VolumeInfos, func(i, j int) bool { return t.VolumeInfos[i].Id < t.VolumeInfos[j].Id }) @@ -117,7 +124,7 @@ func writeDiskInfo(writer io.Writer, t *master_pb.DiskInfo) statistics { for _, ecShardInfo := range t.EcShardInfos { fmt.Fprintf(writer, " ec volume id:%v collection:%v shards:%v\n", ecShardInfo.Id, ecShardInfo.Collection, erasure_coding.ShardBits(ecShardInfo.EcIndexBits).ShardIds()) } - fmt.Fprintf(writer, " Disk %s %+v \n", t.Type, s) + fmt.Fprintf(writer, " Disk %s %+v \n", diskType, s) return s }