weed shell: list volumes

This commit is contained in:
Chris Lu
2019-03-17 20:27:08 -07:00
parent 22fbbf023b
commit aca653c08b
13 changed files with 643 additions and 127 deletions

View File

@@ -2,6 +2,7 @@ package topology
import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"strconv"
"github.com/chrislusf/seaweedfs/weed/glog"
@@ -128,3 +129,17 @@ func (dn *DataNode) ToMap() interface{} {
ret["PublicUrl"] = dn.PublicUrl
return ret
}
func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo {
m := &master_pb.DataNodeInfo{
Id: string(dn.Id()),
VolumeCount: uint64(dn.GetVolumeCount()),
MaxVolumeCount: uint64(dn.GetMaxVolumeCount()),
FreeVolumeCount: uint64(dn.FreeSpace()),
ActiveVolumeCount: uint64(dn.GetActiveVolumeCount()),
}
for _, v := range dn.GetVolumes() {
m.VolumeInfos = append(m.VolumeInfos, v.ToVolumeInformationMessage())
}
return m
}