aboutsummaryrefslogtreecommitdiff
path: root/weed/topology
diff options
context:
space:
mode:
authorbingoohuang <bingoo.huang@gmail.com>2020-05-29 15:37:58 +0800
committerbingoohuang <bingoo.huang@gmail.com>2020-05-29 15:37:58 +0800
commit1a642b98769ea604dfb74fa4d875bf42c24fda9f (patch)
tree115044480b7c8c726e0e5d0bb2f8716952ac74e9 /weed/topology
parentb4e93b639d95da4954052c583e2368baef2992c7 (diff)
downloadseaweedfs-1a642b98769ea604dfb74fa4d875bf42c24fda9f.tar.xz
seaweedfs-1a642b98769ea604dfb74fa4d875bf42c24fda9f.zip
add Volume Ids column only for max 100 volumes for convenience in the master ui.
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...)
+}