aboutsummaryrefslogtreecommitdiff
path: root/weed/topology/data_node.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-12-13 03:11:24 -0800
committerChris Lu <chris.lu@gmail.com>2020-12-13 03:11:24 -0800
commitd156c74ec097add1954fa2a0a9a55eb02b44bb0e (patch)
tree872edef3665d27b852631303f031aa97470f4ad5 /weed/topology/data_node.go
parente9cd798bd372741753efcba2af594b00fe7b8437 (diff)
downloadseaweedfs-d156c74ec097add1954fa2a0a9a55eb02b44bb0e.tar.xz
seaweedfs-d156c74ec097add1954fa2a0a9a55eb02b44bb0e.zip
volume server set volume type and heartbeat to the master
Diffstat (limited to 'weed/topology/data_node.go')
-rw-r--r--weed/topology/data_node.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go
index 0a4df63d0..0ea234202 100644
--- a/weed/topology/data_node.go
+++ b/weed/topology/data_node.go
@@ -50,7 +50,11 @@ func (dn *DataNode) AddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChangedRO
func (dn *DataNode) doAddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChangedRO bool) {
if oldV, ok := dn.volumes[v.Id]; !ok {
dn.volumes[v.Id] = v
- dn.UpAdjustVolumeCountDelta(1)
+ if v.VolumeType == storage.SsdType {
+ dn.UpAdjustSsdVolumeCountDelta(1)
+ } else {
+ dn.UpAdjustVolumeCountDelta(1)
+ }
if v.IsRemote() {
dn.UpAdjustRemoteVolumeCountDelta(1)
}
@@ -89,7 +93,11 @@ func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (newVolume
glog.V(0).Infoln("Deleting volume id:", vid)
delete(dn.volumes, vid)
deletedVolumes = append(deletedVolumes, v)
- dn.UpAdjustVolumeCountDelta(-1)
+ if v.VolumeType == storage.SsdType {
+ dn.UpAdjustSsdVolumeCountDelta(-1)
+ } else {
+ dn.UpAdjustVolumeCountDelta(-1)
+ }
if v.IsRemote() {
dn.UpAdjustRemoteVolumeCountDelta(-1)
}
@@ -116,7 +124,11 @@ func (dn *DataNode) DeltaUpdateVolumes(newVolumes, deletedVolumes []storage.Volu
for _, v := range deletedVolumes {
delete(dn.volumes, v.Id)
- dn.UpAdjustVolumeCountDelta(-1)
+ if v.VolumeType == storage.SsdType {
+ dn.UpAdjustSsdVolumeCountDelta(-1)
+ } else {
+ dn.UpAdjustVolumeCountDelta(-1)
+ }
if v.IsRemote() {
dn.UpAdjustRemoteVolumeCountDelta(-1)
}
@@ -182,6 +194,7 @@ func (dn *DataNode) ToMap() interface{} {
ret["VolumeIds"] = dn.GetVolumeIds()
ret["EcShards"] = dn.GetEcShardCount()
ret["Max"] = dn.GetMaxVolumeCount()
+ ret["MaxSsd"] = dn.GetMaxSsdVolumeCount()
ret["Free"] = dn.FreeSpace()
ret["PublicUrl"] = dn.PublicUrl
return ret
@@ -192,6 +205,8 @@ func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo {
Id: string(dn.Id()),
VolumeCount: uint64(dn.GetVolumeCount()),
MaxVolumeCount: uint64(dn.GetMaxVolumeCount()),
+ MaxSsdVolumeCount: uint64(dn.GetMaxSsdVolumeCount()),
+ SsdVolumeCount: uint64(dn.GetSsdVolumeCount()),
FreeVolumeCount: uint64(dn.FreeSpace()),
ActiveVolumeCount: uint64(dn.GetActiveVolumeCount()),
RemoteVolumeCount: uint64(dn.GetRemoteVolumeCount()),