Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

shell: volume.list output sorted voume list

Chris Lu3f2a30bd05b1
diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.go
index b3dca0d0b5..ab6775f99d 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))
}