Skip to content

Commit

Permalink
update: update Cluster MaxUploadCnt
Browse files Browse the repository at this point in the history
Signed-off-by: leonrayang <[email protected]>
  • Loading branch information
leonrayang committed Aug 10, 2022
1 parent 46aea4d commit 667ee41
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion master/api_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func (m *Server) getQosStatus(w http.ResponseWriter, r *http.Request) {
return
}

sendOkReply(w, r, newSuccessHTTPReply(vol.getQosStatus()))
sendOkReply(w, r, newSuccessHTTPReply(vol.getQosStatus(m.cluster)))
}


Expand Down Expand Up @@ -433,14 +433,17 @@ func (m *Server) getQosUpdateMasterLimit(w http.ResponseWriter, r *http.Request)
if value = r.FormValue(QosMasterLimit); value != "" {
if limit, err = strconv.ParseUint(value, 10, 64); err != nil {
sendErrReply(w, r, newErrHTTPReply(fmt.Errorf("wrong param of limit")))
return
}
if limit < QosMasterAcceptCnt {
sendErrReply(w, r, newErrHTTPReply(fmt.Errorf("limit too less than %v", QosMasterAcceptCnt)))
return
}

m.cluster.cfg.QosMasterAcceptLimit = limit
m.cluster.QosAcceptLimit.SetLimit(rate.Limit(limit))
sendOkReply(w, r, newSuccessHTTPReply("success"))
return
}
sendErrReply(w, r, newErrHTTPReply(fmt.Errorf("no param of limit")))
}
Expand Down
1 change: 1 addition & 0 deletions master/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const (
MinIoLimit = 100
MinMagnify = 10
MaxMagnify = 100
QosMasterAcceptCnt = 5000
MinZoneDiskLimit = 300
MaxZoneDiskLimit = 10000
)
Expand Down
6 changes: 5 additions & 1 deletion master/vol.go
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ func (vol *Vol) checkQos() {
}
}

func (vol *Vol) getQosStatus() interface{} {
func (vol *Vol) getQosStatus(cluster *Cluster) interface{} {

type qosStatus struct {
ServerFactorLimitMap map[uint32]*ServerFactorLimit // vol qos data for iops w/r and flow w/r
Expand All @@ -1216,6 +1216,8 @@ func (vol *Vol) getQosStatus() interface{} {
QosEnable bool
ClientReqPeriod uint32
ClientHitTriggerCnt uint32
ClusterMaxUploadCnt uint32
Cfg uint32
}

return &qosStatus{
Expand All @@ -1226,6 +1228,8 @@ func (vol *Vol) getQosStatus() interface{} {
QosEnable: vol.qosManager.qosEnable,
ClientReqPeriod: vol.qosManager.ClientReqPeriod,
ClientHitTriggerCnt: vol.qosManager.ClientHitTriggerCnt,
ClusterMaxUploadCnt: uint32(cluster.QosAcceptLimit.Limit()),
Cfg: uint32(cluster.cfg.QosMasterAcceptLimit),
}
}

Expand Down

0 comments on commit 667ee41

Please sign in to comment.