aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_list.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-02-16 10:55:30 -0800
committerChris Lu <chris.lu@gmail.com>2021-02-16 10:55:30 -0800
commit0611233f16ff0e8f4b99aa6528f47153efd9a846 (patch)
tree58420580b87e98624d873fe9b3d896bcb0b218a1 /weed/shell/command_volume_list.go
parent68775d29e3a2e2a65b3b719c1d087b6616a0d18e (diff)
downloadseaweedfs-0611233f16ff0e8f4b99aa6528f47153efd9a846.tar.xz
seaweedfs-0611233f16ff0e8f4b99aa6528f47153efd9a846.zip
adjust printing
Diffstat (limited to 'weed/shell/command_volume_list.go')
-rw-r--r--weed/shell/command_volume_list.go11
1 files 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
}