aboutsummaryrefslogtreecommitdiff
path: root/weed/topology/data_node.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@uber.com>2019-03-17 20:27:08 -0700
committerChris Lu <chris.lu@uber.com>2019-03-17 20:27:08 -0700
commitaca653c08bfaae205e3a62ae9e58ce327a5a583f (patch)
tree83cc519f45f0186c10365c5a332e8a995fdb00ed /weed/topology/data_node.go
parent22fbbf023b180e3c51261b0746a52be715e86648 (diff)
downloadseaweedfs-aca653c08bfaae205e3a62ae9e58ce327a5a583f.tar.xz
seaweedfs-aca653c08bfaae205e3a62ae9e58ce327a5a583f.zip
weed shell: list volumes
Diffstat (limited to 'weed/topology/data_node.go')
-rw-r--r--weed/topology/data_node.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go
index 6ea6d3938..84304512f 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/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
+}