aboutsummaryrefslogtreecommitdiff
path: root/weed/topology
diff options
context:
space:
mode:
Diffstat (limited to 'weed/topology')
-rw-r--r--weed/topology/data_node.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go
index 617341e54..f6e96e235 100644
--- a/weed/topology/data_node.go
+++ b/weed/topology/data_node.go
@@ -2,6 +2,7 @@ package topology
import (
"fmt"
+ "github.com/chrislusf/seaweedfs/weed/util"
"strconv"
"sync"
@@ -166,6 +167,7 @@ func (dn *DataNode) ToMap() interface{} {
ret := make(map[string]interface{})
ret["Url"] = dn.Url()
ret["Volumes"] = dn.GetVolumeCount()
+ ret["VolumeIds"] = dn.GetVolumeIds()
ret["EcShards"] = dn.GetEcShardCount()
ret["Max"] = dn.GetMaxVolumeCount()
ret["Free"] = dn.FreeSpace()
@@ -190,3 +192,19 @@ func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo {
}
return m
}
+
+// GetVolumeIds returns the human readable volume ids limited to count of max 100.
+func (dn *DataNode) GetVolumeIds() string {
+ volumesLen := len(dn.volumes)
+ if volumesLen > 100 {
+ return "..."
+ }
+
+ ids := make([]int, 0, volumesLen)
+
+ for k := range dn.volumes {
+ ids = append(ids, int(k))
+ }
+
+ return util.HumanReadableInts(ids...)
+}