mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-01-18 14:41:31 +08:00
fix volume server display for volumes
This commit is contained in:
parent
c78409a598
commit
c576ad04ac
@ -207,7 +207,26 @@ func (dn *DataNode) ToMap() interface{} {
|
||||
ret := make(map[string]interface{})
|
||||
ret["Url"] = dn.Url()
|
||||
ret["PublicUrl"] = dn.PublicUrl
|
||||
ret["Disks"] = dn.diskUsages.ToMap()
|
||||
|
||||
// aggregated volume info
|
||||
var volumeCount, ecShardCount, maxVolumeCount int64
|
||||
var volumeIds string
|
||||
for _, diskUsage := range dn.diskUsages.usages {
|
||||
volumeCount += diskUsage.volumeCount
|
||||
ecShardCount += diskUsage.ecShardCount
|
||||
maxVolumeCount += diskUsage.maxVolumeCount
|
||||
}
|
||||
|
||||
for _, disk := range dn.Children() {
|
||||
d := disk.(*Disk)
|
||||
volumeIds += d.GetVolumeIds()
|
||||
}
|
||||
|
||||
ret["Volumes"] = volumeCount
|
||||
ret["EcShards"] = ecShardCount
|
||||
ret["Max"] = maxVolumeCount
|
||||
ret["volumeIds"] = volumeIds
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
|
@ -58,16 +58,6 @@ func (d *DiskUsages) negative() *DiskUsages {
|
||||
return t
|
||||
}
|
||||
|
||||
func (d *DiskUsages) ToMap() interface{} {
|
||||
d.RLock()
|
||||
defer d.RUnlock()
|
||||
ret := make(map[string]interface{})
|
||||
for diskType, diskUsage := range d.usages {
|
||||
ret[diskType.String()] = diskUsage.ToMap()
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (d *DiskUsages) ToDiskInfo() map[string]*master_pb.DiskInfo {
|
||||
ret := make(map[string]*master_pb.DiskInfo)
|
||||
for diskType, diskUsageCounts := range d.usages {
|
||||
@ -135,15 +125,6 @@ func (a *DiskUsageCounts) minus(b *DiskUsageCounts) *DiskUsageCounts {
|
||||
}
|
||||
}
|
||||
|
||||
func (diskUsage *DiskUsageCounts) ToMap() interface{} {
|
||||
ret := make(map[string]interface{})
|
||||
ret["Volumes"] = diskUsage.volumeCount
|
||||
ret["EcShards"] = diskUsage.ecShardCount
|
||||
ret["Max"] = diskUsage.maxVolumeCount
|
||||
ret["Free"] = diskUsage.FreeSpace()
|
||||
return ret
|
||||
}
|
||||
|
||||
func (du *DiskUsages) getOrCreateDisk(diskType types.DiskType) *DiskUsageCounts {
|
||||
du.Lock()
|
||||
defer du.Unlock()
|
||||
|
Loading…
Reference in New Issue
Block a user