|
@ -2,6 +2,7 @@ package topology |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"fmt" |
|
|
"fmt" |
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/util" |
|
|
"strconv" |
|
|
"strconv" |
|
|
"sync" |
|
|
"sync" |
|
|
|
|
|
|
|
@ -166,6 +167,7 @@ func (dn *DataNode) ToMap() interface{} { |
|
|
ret := make(map[string]interface{}) |
|
|
ret := make(map[string]interface{}) |
|
|
ret["Url"] = dn.Url() |
|
|
ret["Url"] = dn.Url() |
|
|
ret["Volumes"] = dn.GetVolumeCount() |
|
|
ret["Volumes"] = dn.GetVolumeCount() |
|
|
|
|
|
ret["VolumeIds"] = dn.GetVolumeIds() |
|
|
ret["EcShards"] = dn.GetEcShardCount() |
|
|
ret["EcShards"] = dn.GetEcShardCount() |
|
|
ret["Max"] = dn.GetMaxVolumeCount() |
|
|
ret["Max"] = dn.GetMaxVolumeCount() |
|
|
ret["Free"] = dn.FreeSpace() |
|
|
ret["Free"] = dn.FreeSpace() |
|
@ -190,3 +192,19 @@ func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo { |
|
|
} |
|
|
} |
|
|
return m |
|
|
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...) |
|
|
|
|
|
} |