aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-05-05 20:23:50 -0700
committerChris Lu <chris.lu@gmail.com>2019-05-05 20:23:50 -0700
commit3f2a30bd05b180e679226a6114e75551c10ea7a6 (patch)
tree84a6f976fa9f61ac899702525925440781254d9f
parent46a675ecc2558635cf9f8eae90b3d974636ddff0 (diff)
downloadseaweedfs-3f2a30bd05b180e679226a6114e75551c10ea7a6.tar.xz
seaweedfs-3f2a30bd05b180e679226a6114e75551c10ea7a6.zip
shell: volume.list output sorted voume list
-rw-r--r--weed/shell/command_volume_list.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.go
index b3dca0d0b..ab6775f99 100644
--- a/weed/shell/command_volume_list.go
+++ b/weed/shell/command_volume_list.go
@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"io"
+ "sort"
)
func init() {
@@ -38,12 +39,15 @@ func (c *commandVolumeList) Do(args []string, commandEnv *commandEnv, writer io.
return err
}
- writeTopologyInfo(writer, resp.TopologyInfo)
+ writeTopologyInfo(writer, resp.TopologyInfo, resp.VolumeSizeLimitMb)
return nil
}
-func writeTopologyInfo(writer io.Writer, t *master_pb.TopologyInfo) statistics {
- fmt.Fprintf(writer, "Topology volume:%d/%d active:%d free:%d\n", t.VolumeCount, t.MaxVolumeCount, t.ActiveVolumeCount, t.FreeVolumeCount)
+func writeTopologyInfo(writer io.Writer, t *master_pb.TopologyInfo, volumeSizeLimitMb uint64) statistics {
+ fmt.Fprintf(writer, "Topology volume:%d/%d active:%d free:%d volumeSizeLimit:%d MB\n", t.VolumeCount, t.MaxVolumeCount, t.ActiveVolumeCount, t.FreeVolumeCount, volumeSizeLimitMb)
+ sort.Slice(t.DataCenterInfos, func(i, j int) bool {
+ return t.DataCenterInfos[i].Id < t.DataCenterInfos[j].Id
+ })
var s statistics
for _, dc := range t.DataCenterInfos {
s = s.plus(writeDataCenterInfo(writer, dc))
@@ -54,6 +58,9 @@ func writeTopologyInfo(writer io.Writer, t *master_pb.TopologyInfo) statistics {
func writeDataCenterInfo(writer io.Writer, t *master_pb.DataCenterInfo) statistics {
fmt.Fprintf(writer, " DataCenter %s volume:%d/%d active:%d free:%d\n", t.Id, t.VolumeCount, t.MaxVolumeCount, t.ActiveVolumeCount, t.FreeVolumeCount)
var s statistics
+ sort.Slice(t.RackInfos, func(i, j int) bool {
+ return t.RackInfos[i].Id < t.RackInfos[j].Id
+ })
for _, r := range t.RackInfos {
s = s.plus(writeRackInfo(writer, r))
}
@@ -63,6 +70,9 @@ func writeDataCenterInfo(writer io.Writer, t *master_pb.DataCenterInfo) statisti
func writeRackInfo(writer io.Writer, t *master_pb.RackInfo) statistics {
fmt.Fprintf(writer, " Rack %s volume:%d/%d active:%d free:%d\n", t.Id, t.VolumeCount, t.MaxVolumeCount, t.ActiveVolumeCount, t.FreeVolumeCount)
var s statistics
+ sort.Slice(t.DataNodeInfos, func(i, j int) bool {
+ return t.DataNodeInfos[i].Id < t.DataNodeInfos[j].Id
+ })
for _, dn := range t.DataNodeInfos {
s = s.plus(writeDataNodeInfo(writer, dn))
}
@@ -72,6 +82,9 @@ func writeRackInfo(writer io.Writer, t *master_pb.RackInfo) statistics {
func writeDataNodeInfo(writer io.Writer, t *master_pb.DataNodeInfo) statistics {
fmt.Fprintf(writer, " DataNode %s volume:%d/%d active:%d free:%d\n", t.Id, t.VolumeCount, t.MaxVolumeCount, t.ActiveVolumeCount, t.FreeVolumeCount)
var s statistics
+ sort.Slice(t.VolumeInfos, func(i, j int) bool {
+ return t.VolumeInfos[i].Id < t.VolumeInfos[j].Id
+ })
for _, vi := range t.VolumeInfos {
s = s.plus(writeVolumeInformationMessage(writer, vi))
}